blazy icon indicating copy to clipboard operation
blazy copied to clipboard

Lazy loading visible images but not working on scroll

Open volkan-umg opened this issue 7 years ago • 2 comments

When my page loads 2 images are visible and I can see the placeholders being replaced by the actual images. There are 2 more further down the page but when I scroll down they are never replaced. For testing purposes I'm using the same img element for all 4 images:

<img data-src="/img/test-images/test-large-2.jpg" src="/img/test-images/test-large-placeholder.jpg" />

This is how I initialize blazy:

Is it supposed to work for lazy loading on scroll out of the box or does it require more configuration?

Thanks.

volkan-umg avatar Nov 30 '17 14:11 volkan-umg

I read in the documentation that we need to call bLazy.revalidate(). I tried this but still does not work.

rajesh1158 avatar Dec 23 '17 11:12 rajesh1158

If your images are in a scrolling container, you will need to add the container key to the init.

container: '#scrolling-container' // Default is window

RyanBertrand avatar Jan 10 '18 17:01 RyanBertrand