Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iframe data-src to src not replace #942

Open
onderakbulut opened this issue Feb 6, 2022 · 3 comments
Open

iframe data-src to src not replace #942

onderakbulut opened this issue Feb 6, 2022 · 3 comments
Labels

Comments

@onderakbulut
Copy link

Thank you for the plugin.
I used this on iframe but it is not replaced video link data-src to src could you help me?

@t-franz
Copy link

t-franz commented Dec 15, 2022

I have the same problem. The script does not replace the data-src:

<iframe 
data-src="https://www.loom.com/embed/123" 
frameborder="0" 
loading="lazy" 
class="lazyload" 
webkitallowfullscreen="" 
mozallowfullscreen="" 
allowfullscreen="">
</iframe>

Images are okay, but i can't get it to work with iframes ...

@glen-84
Copy link

glen-84 commented Mar 23, 2023

Did you try iframeLoadMode: 1?

var changeIframeSrc = function(elem, src){
var loadMode = elem.getAttribute('data-load-mode') || lazySizesCfg.iframeLoadMode;
// loadMode can be also a string!
if (loadMode == 0) {
elem.contentWindow.location.replace(src);
} else if (loadMode == 1) {
elem.src = src;
}
};

@rr-it
Copy link

rr-it commented Apr 7, 2023

The iframeLoadMode: 1 is necessary for the fullscreen mode to work in Vimeo video player.
How about making this the new default?

Without fullscreen:
grafik

With fullscreen:
grafik

<script>
    window.lazySizesConfig = {
        iframeLoadMode: 1
    };
</script>
<script src="lazysizes.min.js"></script>

OR

<iframe class="lazyload" data-load-mode="1" data-src="https://player.vimeo.com/video/1084537" width="640" height="360" allowfullscreen allow="fullscreen" ></iframe>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants