Don't load the image until the user scrolls there, maybe?

If I don't want the image to be loaded from the server until the user scrolls through it, what event should I capture?

But as?

+3


source to share


1 answer


I have used this plugin (Lazy Load) in a project and it works really well.

And here's how, the trick is to put an empty placeholder image and add data data from the real image path.



<img class="lazy" src="img/grey.gif" data-original="img/example.jpg"  width="640" heigh="480">

      

then in your code do:

$("img.lazy").lazyload();

      

+2


source







All Articles