Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery LazyLoad do not load images until scroll

jQuery LazyLoad doesn't load images in open page's visible part until I scroll page even on 1px.

When I scroll page all works right

Update:

CoffeScript

jQuery ->
   $("img.lazy").show().lazyload()
   $(window).resize()

But $(window).resize() helps only if i enter it from browser's console when page have loaded

like image 876
Alexey Avatar asked Dec 20 '12 11:12

Alexey


2 Answers

$("img.lazy").lazyload({
             threshold : 50
         });

And add this:

$(window).load(function(){
     $("html,body").trigger("scroll");
});
like image 142
Mario Gonzales Flores Avatar answered Sep 22 '22 05:09

Mario Gonzales Flores


Your images must have width and height set.

like image 27
Mika Tuupola Avatar answered Sep 18 '22 05:09

Mika Tuupola