dinbror / blazy

Hey, be lazy! bLazy.JS is a lightweight pure JavaScript script for lazy loading and multi-serving images. It's working in all modern browsers including IE7+.
http://dinbror.dk/blazy
MIT License
2.63k stars 355 forks source link

Lazy loading visible images but not working on scroll #158

Open volkan-umg opened 6 years ago

volkan-umg commented 6 years ago

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.

rajesh1158 commented 6 years ago

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

RyanBertrand commented 6 years ago

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