Jquery lazyload with ajax

后端 未结 8 1487
-上瘾入骨i
-上瘾入骨i 2021-01-17 23:26

I use lazyload() on my ecommerce website. lazyload() works great. I use this code to do that:

$(function(){
  $(\"img.lazy\").lazyload({ 
  effect : \"fadeIn         


        
8条回答
  •  心在旅途
    2021-01-18 00:25

    I have same problem, when using waypoints infinite scroll with lazy load image. (but not work on ajax content).

    and I fixed that issue with this :

    $("img.lazy").lazyload({
        effect : "fadeIn",
        event: "scrollstop",
        skip_invisible : true
    }).removeClass('lazy');
    
    $(document).bind('DOMNodeInserted', function(e) {
        $("img.lazy").lazyload({
            effect : "fadeIn",
            event: "scrollstop",
            skip_invisible : true
        }).removeClass('lazy');
    });
    

    I bind the lazy load configuration on DOMNodeInserted event.

提交回复
热议问题