jquery - Lazy Loading in Flexslider -
i trying lazy loading working flexslider using lazy loading jquery plugin , following instructions on site: http://www.appelsiini.net/projects/lazyload
i loading plugin script , don't see errors on console. tried without container or options being passed in lazyload function , still nothing. spend hours on this.
$("img.lazy").lazyload({ effect: "fadein", container: $(".slides > li") });
does know how lazy loading working in flexslider?
i implemented lazy load during scrolling. solution works better big collections in comparison other solutions proposed here. during initialization loads first 5 images , loads ahead 3 images every animation.
<li> <img class="lazy" src="loading-image.jpg" data-src="actual-image.jpg" /> </li>
and javascript code:
$('.flexslider').flexslider({ animation: "slide", animationloop: false, controlnav: false, init: function (slider) { // lazy load $("img.lazy").slice(0,5).each(function () { var src = $(this).attr("data-src"); $(this).attr("src", src).removeattr("data-src").removeclass("lazy"); }); }, before: function (slider) { // lazy load $("img.lazy").slice(0,3).each(function () { var src = $(this).attr("data-src"); $(this).attr("src", src).removeattr("data-src").removeclass("lazy"); }); } });
Comments
Post a Comment