Giter Site home page Giter Site logo

lazyload's Introduction

Lazy Load Remastered

Lazy Load delays loading of images in long web pages. Images outside of viewport will not be loaded before user scrolls to them. This is opposite of image preloading.

This is a modern vanilla JavaScript version of the original Lazy Load plugin. It uses Intersection Observer API to observe when the image enters the browsers viewport. Original code was inspired by YUI ImageLoader utility by Matt Mlinac. New version loans heavily from a blog post by Dean Hume.

Basic Usage

By default Lazy Load assumes the URL of the original high resolution image can be found in data-src attribute. You can also include an optional low resolution placeholder in the src attribute.

<script src="https://cdn.jsdelivr.net/npm/[email protected]/lazyload.js"></script>

<img class="lazyload" data-src="img/example.jpg" width="765" height="574" />
<img class="lazyload" src="img/example-thumb.jpg" data-src="img/example.jpg" width="765" height="574" />

With the HTML in place you can then initialize the plugin using the factory method. If you do not pass any settings or image elements it will lazyload all images with class lazyload.

lazyload();

If you prefer you can explicitly pass the image elements to the factory. Use this for example if you use different class name.

let images = document.querySelectorAll(".branwdo");
lazyload(images);

If you prefer you can also use the plain old constructor.

let images = document.querySelectorAll(".branwdo");
new LazyLoad(images);

The core IntersectionObserver can be configured by passing an additional argument

new LazyLoad(images, {
     root: null,
     rootMargin: "0px",
     threshold: 0
});

Additional API

To use the additional API you need to assign the plugin instance to a variable.

let lazy = lazyload();

To force loading of all images use loadimages().

lazy->loadImages();

To destroy the plugin and stop lazyloading use destroy().

lazy->destroy();

Note that destroy() does not load the out of viewport images. If you also want to load the images use loadAndDestroy().

lazy->loadAndDestroy();

Additional API is not avalaible with the jQuery wrapper.

jQuery Wrapper

If you use jQuery there is a wrapper which you can use with the familiar old syntax. Note that to provide BC it uses data-original by default. This should be a drop in replacement for the previous version of the plugin.

<img class="lazyload" data-original="img/example.jpg" width="765" height="574">
<img class="lazyload" src="img/example-thumb.jpg" data-original="img/example.jpg" width="765" height="574">
$("img.lazyload").lazyload();

Cookbook

Blur Up Images

Low resolution placeholder ie. the "blur up" technique. You can see this in action in this blog entry. Scroll down to see blur up images.

<img class="lazyload"
     src="thumbnail.jpg"
     data-src="original.jpg"
     width="1024" height="768" />
<div class="lazyload"
     style="background-image: url('thumbnail.jpg')"
     data-src="original.jpg" />

Responsive Images

Lazyloaded Responsive images are supported via data-srcset. If browser does not support srcset and there is no polyfill the image from data-src will be shown.

<img class="lazyload"
     src="thumbnail.jpg"
     data-src="large.jpg"
     data-srcset="small.jpg 480w, medium.jpg 640w, large.jpg 1024w"
     width="1024" height="768" />
<img class="lazyload"
     src="thumbnail.jpg"
     data-src="normal.jpg"
     data-srcset="normal.jpg 1x, retina.jpg 2x"
     width="1024" height="768" />

Inlined Placeholder Image

To reduce the amount of request you can use data uri images as the placeholder.

<img src="data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs="
     data-src="original.jpg"
     width="1024" height="768" />

Install

This is still work in progress. You can install beta version with yarn or npm.

$ yarn add lazyload
$ npm install lazyload

License

All code licensed under the MIT License. All images licensed under Creative Commons Attribution 3.0 Unported License. In other words you are basically free to do whatever you want. Just don't remove my name from the source.

lazyload's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lazyload's Issues

Isotope filtering + Lazy loading

I've spent considerable amount of time trying to get isotope and lazy loading working together.

The issue: lazy loading works if the user scrolls down, however if the user uses the filters, the items show up on top but the images will not load.

Here is someone with the same issue, but it seems he fixed it. I tried several things but still couldnt get it working.

Here is the dicussion #51

Thanks alot for your help

The code I am using is as follow.

jQuery(document).ready(function($) {
$('#big_container .media_block img').each(function(index) {
var item_height = $(this).attr("height");
$(this).parent().parent().css("height",item_height);
});
$('#big_container').isotope({
itemSelector : '.item',
layoutMode : 'masonry',
masonry: {
columnWidth: 5,
},
sortBy : 'date',
sortAscending : false,
getSortData : {
date : function ( $elem ) {
return $elem.find('.date').text(); // Date format should be [Y-m-d H:i]
},
views : function( $elem ) {
return parseInt( $elem.attr('data-views'), 10 );
},
//featured : function ( $elem ) {
// return $elem.attr('data-featured');
// },
rates : function( $elem ) {
return parseInt( $elem.attr('data-rates'), 10 );
},
comments : function( $elem ) {
return parseInt( $elem.attr('data-comments'), 10 );
}
}

});

$('#sort-by li a').click(function(){
    var $this = $(this);
    if ($(this).parent().hasClass('selected') ) {
      return false;
    }
    var $optionSet = $this.parents();
    $optionSet.find('.selected').removeClass('selected');
       $this.addClass('selected');
      var sortName = $(this).attr('href').slice(1);
      $('#big_container').isotope({ sortBy : sortName });
      return false;
});

});

v1.8.3 doesn't load images for cached pages

First of all, great plugin.

Version 1.8.3 was released to fix a Webkit initial scroll problem, but it appears to have created an entirely new problem:

When a page is freshly loaded for the first time or refreshed (F5), the lazy loaded image(s) loads fine. But if the page is called from the browser's cache, such as clicking the browser's back button, the images won't load without an "initial scroll"

I've experienced this in Google Chrome desktop and Safari 6.0 mobile.

By the way, I don't remember experiencing an initial load problem in v1.8.2.

Bootstrap responsive and height:auto

Hi, With Twitter Boostrap responsive, all img take "height: auto" in css. When my page load, first the image have no height, so jquery_lazyload load a lot of image.

Then image take the real height, so it's not visible and it's already load...

I do this to load lazyload :

$(document).ready(function() {
    $("img.sale_image").lazyload( {
        effect : "fadeIn"
    });
});

Unabstract update() method

Is there anyway we could unabstract the update method and move it out into a global scope, or make it more accessible so we can manually call it if need be?

LazyLoad on Mobile Devices

It is possible to had a "concurrent" setting? I say this because if data-original is a webservice (not an image on a remote server but a WebService that returns an image) mobile devices will hang when there are a list of images (100 or so) because there will be many concurrent requests.

It would be also nice to had a setting to unload "off-viewport" loaded images if a certain ammount is reached (to release memory).

Thanks!

effect: fadeIn not working in ios

Does anyone know why effect: fadeIn doesn't work on iPhone (ios6)? The images load, but never fade in. Everything works as expected without the effect.

(The effect works in my ios simulator which is an older version - 4.2, and desktop browsers).

Thanks, kyle

Allow a callback to be trigered once image is loaded

First, thanks for the great plugin.

People might be interested in having a callback triggered once image get loaded.

If you want you can include the change into the plugin, it may help others.

Index: jquery.lazyload.js

===================================================================
--- jquery.lazyload.js  (revision 273)
+++ jquery.lazyload.js  (working copy)
@@ -20,7 +20,8 @@
             failurelimit : 0,
             event        : "scroll",
             effect       : "show",
-            container    : window
+            container    : window,
+            callback    : null
         };

         if(options) {
@@ -89,6 +90,9 @@
                                 .hide()
                                 .attr("src", $(self).attr("original"))
                                 [settings.effect](settings.effectspeed);
+                            if(settings.callback)
+                               callback($(self));
+                            
                             self.loaded = true;
                         })
                         .attr("src", $(self).attr("original"));

When images are loaded via AJAX?

Hello,

I use this great plugin at http://www.gablabelle.com/ and it works great but when the images are loaded via AJAX (When you click on a thumbnail to load a post) the plugin doesn't seem to work on these images. Could it be that it's because they were not initially in the DOM?

Any idea what I could do to solve this?

Many thanks.

feature request - initial update checks every image in 'elements'

In my use case I have a right hand column that is defined near the bottom of the html code but appears at the top of the rendered html page. With the failure limit set to 0 none of the images in the right hand column load on the initial update. I also have a few large pages have slow performance if I set the failure limit to a large number.

It would be nice if there was a setting that would force the update function to iterate over all the items in elements on the initial call but respect the failure_limit setting on all other update calls.

The following code does what I am suggesting but perhaps there is a better way to do this or maybe it should be controlled by a new setting:

    /* Force initial check if images should appear. */
    var failTemp = settings.failure_limit;
    settings.failure_limit = elements.length;
    update();
    settings.failure_limit = failTemp;

Generating placeholders (Compatibility with holder.js)

It would be really cool if lazyload.js and holder.js worked together. The justification for this is that these plugins have highly complementary roles in handling image loading.

The two main problems with making these two plugins compatible are:

  1. that lazyload only accepts properly specified src="/img/bg.png" or background-image=url("/img/bg.png") attributes. It can't handle the holder.js syntax/data-src.
  2. Responsive images (% instead of px) don't work since holder converts <img> tags with %width/height to <div>s thereby creating incompatibility with lazyload.

What are people's thoughts on automating placeholder generation?

Option failure_limit does not work

When the failure_limit option was added back on Dec-01, the code to maintain backwards compatibility was added incorrectly. The code checks for option.failurelimit to not strictly equal null. If the option is omitted (as it should be going forward), the check still returns true (null !== undefined) and then incorrectly overrides any specified value for option.failurelimit to 0. I believe the proper check should be:

if (undefined !== options.failurelimit) {}

JavaScript not executed after clicking back button on IOS5

Not directly related to Lazy Load. On IOS5 mobile Safari JavaScript is not executed when user clicks back button. Thus when user navigates away from page and comes back using back button images which have not been loaded yet will not be loaded even after scrolling.

Dirty workaround is to call window.onpopstate handler twice. First call happens on initial pageload. It will bind the second call to make all images appear. Second call happens when user clicks back button.

window.onpopstate = function() { 
    window.onpopstate = function() {
        $("img.lazy").trigger("appear");
    };
};

This is not optimal but works until real solution can be found. Another option seems to be something like (untested code):

if ((/iphone|ipod|ipad.*os 5/gi).test(navigator.appVersion)) {
    window.onpageshow = function(event) {
        if (event.persisted) {
            $("img.lazy").trigger("appear");
        };
    };
}

Load images based on position from the top

Hi,

I have images in 2 columns and in HTML these are 2 divs, so when I scroll the page instead of starting from the top it loads first column and then the second one. Is it possible to somehow load images in order?

Add a license

Would it be possible to add a license to this project?

Thanks

Binding multiple events

Hi,
Is it possible to bind multiple events?
Some scenarios where it could be useful:

  1. Autocomplete like search box I want to be able to add filter all the images and load them. Now, as a work around I need to trigger the scrol event.
  2. Pre-load the hidden images. I have a list of 200+ images, only the first 5 are visible. So I want to first load only the first 5, but after a few sec the browser is ideal, so I might as well load the other images. It would be nice if I could bind the sporty event.

Images and HTML license

Hi!

Could you please add a license file or a site note about license of images and HTML?

Thanks.

Memory Leak with IE7

It seams that there is a memory leak with IE7.

I noticed on my app and it took my a while to pinpoint what was causing the leak. Eventually I nailed it down to the lazy loading of my images.

I then went on the demo page (for the use of container) and I noticed the same behavior. Every time I refresh the page the IE memory increases about 10-15mb each time.

Is this a known issue?

Let me know, and thanks again for the help.

no loading for 2nd rows of floating divs

Hello,

I'm displaying a thumb list in two rows.
The images are enclosed in left float DIVs within a horizontally scrollable div.

The first row of images is well lazy loaded but the next rows are still grey ... unless I scroll to the end (right) and then scroll back on the left.

Here is a piece of HTML code.

Thank you for this nice work and merry Christmas :)

<style type="text/css">

wrap { position: relative; height:225px; width:640px; overflow-x:auto;overflow-y:hidden}

content {height:205px;}

content div, #content img { width:160px; height:100px;}

wrap, #content {margin:0;padding:0}

content div {float:left;margin:0;padding:1px}

nav {position:fixed; top:20px; left:500px}
</style>
<div id="wrap">
<div id="content" style="width: 1944px;">
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/SR1102.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/SA0801.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/BE0801.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/GL0401.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/MT0920.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/CI0901.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/GK0501.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/CU1001.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/LE0710.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/BA0701.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/GC1201.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/BA0503.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/DE1101.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/SL0801.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/LS0701.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/LD0601.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/DE0803.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/MU0601.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/AZ0510.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/JN0701.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/BN0820.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/TD0801.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/GO0601.jpg" src="grey.gif"></div>
<div><img data-original="http://citelocal/mutu/cm/catalogplans/thnail/DS0801.jpg" src="grey.gif"></div>
</div>
</div>

Removing bound events when image loads

Would be nice if the image appear and load events were removed once the image is loaded via the plugin.

$self.unbind('appear');
$self.unbind('load');

`scroll` event optimization

      // `scroll` event optimization
        var scrollMonitor;
        if (0 === settings.event.indexOf("scroll")) {
            var timer;
            scrollMonitor = function(event) {
                if(timer){
                    clearTimeout(timer);
                }
                timer = setTimeout(function(){
                    update();
                },settings.timer || 30);
            };
            $container.bind('scroll', scrollMonitor);
        }

Then unbind scroll event after all imgs loaded.

if(elements.length === 0){
    $container.unbind('scroll', scrollMonitor);
}

Lazy Load is not working in Internet Explorer 8

"ajax-loader_s.gif" never gets replaced with "test.jpg", no JS errors shown in console.

HTML:

<img class="lazy" width="50" height="50" src="ajax-loader_s.gif" data-original="test.jpg" alt="" />

JS:

$(function() {
    $('img.lazy').lazyload();
});

Use data-uri instead of

You should use a data-uri instead of <img data-original=“img/example.jpg” src=“img/grey.gif”>. Less http requests.

-> <img data-original=“img/example.jpg” src=“src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="”>

All images loading and not being lazy

I thought this was working before, but I've just noticed that all my images on my page are loading at load time.

I have a search results page that has over 100 images loading and all images get triggered immediately.

this is my setup:

all image tags:

<img src="blank.gif" data-original="some-image.jpg" class="lazy image-class" alt="" />

js config:

$('img.lazy').lazyload({
    threshold: 300,
    effect: 'fadeIn',
    container: "#my-container",
    skip_invisible: false
});

However, when I look at my Net tab in firebug i see all images load up instead of just 6 to 9 of them (i have rows of three items that are tall relative to the window viewport height so with a 300px threshold, only the next row or two at most should load up resulting in 6 to 9 total items loading up at any one time).

Has anyone experienced? Is there something i'm missing? I tried running this against jquery 1.7.2 and 1.8.3 and the results were the same for both. I also tried removing the skip_invisible flag to no avail.

When I use the unminified version of the script, it's always executing this chunk of code:

...
} else if (!$.belowthefold(this, settings) &&
    !$.rightoffold(this, settings)) {
    $this.trigger("appear");
    /* if we found an image we'll load, reset the counter */
    counter = 0;
}
...

Maybe this is a non-issue and I'm just missing a simple configuration, but I'm not too sure why this is happening now.

This is also with the latest build of 1.8.3 (which happens to be the same jquery build version)

1.8.3 - new initial update() behavior crashes image loading

After upgrading from 1.8.2 to 1.8.3 (to address the Safai/Webkit initial loading bug),
images (using a container in my case) did not load dynamically.

To get both working (Safari and the dynamically loading) I simply copied the old function back in:

Line #147:
/* Force initial check if images should appear. */
$(window).load(function() {
update();
});
$(document).ready(function() {
update();
});

just FYI the function I use to "dynamically" assign a lazyload (as I have around 100 containers with several pictures on one page, I cannot initialize all lazyloaders at once due to performance):

$("img.lazy").show().lazyload({
effect : "fadeIn",
placeholder: "images/loading.gif",
container: $('#scroller'+scroller)
});

while the sroller variable is the id of the container that I want to load dynamically after an event fires (click, scroll).

lazyload does not work with multiple containers (any more)

$container is a global var that is overwritten each time lazyload is called. either revert 79a4d65 or make it a object variable (<var $container = [...]>).

e.g. see diff below:

--- jquery.lazyload.original.js
+++ jquery.lazyload.js
@@ -67,13 +67,9 @@
             $.extend(settings, options);
         }

-        /* Cache container as jQuery as object. */
-        $container = (settings.container === undefined ||
-                      settings.container === window) ? $window : $(settings.container);
-
         /* Fire one scroll event per scroll. Not one scroll event per image. */
         if (0 === settings.event.indexOf("scroll")) {
-            $container.bind(settings.event, function(event) {
+            $(settings.container).bind(settings.event, function(event) {
                 return update();
             });
         }
@@ -145,7 +141,7 @@
         if (settings.container === undefined || settings.container === window) {
             fold = $window.height() + $window.scrollTop();
         } else {
-            fold = $container.offset().top + $container.height();
+            fold = $(settings.container).offset().top + $(settings.container).height();
         }

         return fold <= $(element).offset().top - settings.threshold;
@@ -157,7 +153,7 @@
         if (settings.container === undefined || settings.container === window) {
             fold = $window.width() + $window.scrollLeft();
         } else {
-            fold = $container.offset().left + $container.width();
+            fold = $(settings.container).offset().left + $(settings.container).width();
         }

         return fold <= $(element).offset().left - settings.threshold;
@@ -169,7 +165,7 @@
         if (settings.container === undefined || settings.container === window) {
             fold = $window.scrollTop();
         } else {
-            fold = $container.offset().top;
+            fold = $(settings.container).offset().top;
         }

         return fold >= $(element).offset().top + settings.threshold  + $(element).height();
@@ -181,7 +177,7 @@
         if (settings.container === undefined || settings.container === window) {
             fold = $window.scrollLeft();
         } else {
-            fold = $container.offset().left;
+            fold = $(settings.container).offset().left;
         }

         return fold >= $(element).offset().left + settings.threshold + $(element).width();
@@ -207,4 +203,4 @@
         "left-of-fold"   : function(a) { return !$.rightoffold(a, {threshold : 0, container: window}); }
     });

-})(jQuery, window);
\ No newline at end of file
+})(jQuery, window);

Poor scroll detection on touch devices

If you use this on a touch device (EX: iPad), images do not lazy load until you stop scrolling (a poor experience). This is because the scroll event does not fire until you've stopped scrolling. The fix for this is to add an on touchmove event that triggers the lazy loading.

$(window).height() and Mobile Safari

Basically $(window).height() doesn't work correctly on Mobile Safari. On an iPhone 5 it always returns 444 which is only true when the (entire) address bar is visible. If the address bar is scrolled out of sight it should return 504, but still it return only 444.

What this means is that I have to set a threshold of 60 which is the height of the address bar, if I want images to start load a soon as the appear above the fold.

A solution would be to use window.innerHeight instead of $(window).height(), as this will give the correct value in all cases.

Feature request - Support pre-loading images

Thanks for the awesome plugin. This is just a feature request:

Use case - In product listing pages, it would be nice to have an option where I can preload say the next 5 images so that when the user scrolls he can immediately see the images instead of waiting for them to appear.

I do have a basic implementation of this with me, and it works in a way that saves bandwidth for me and at the same time the user will not know that preloading is happening.

Exprose error handler

Right now when loading an image the error won't be triggered if image would give a 404 so let's trigger the error event which is set to the original image.

This is the my code for exposing loading error:

$("<img />")
.bind("load", function() {
    $(self)
        .hide()
        .attr("src", $(self).data("original"))
        [settings.effect](settings.effectspeed);
    self.loaded = true;
})
.bind("error", function(){
    // Lazy loader hides the 404 error, so to be able to add callback code
    $(self).trigger('error');
})
.attr("src", $(self).data("original"));

Thanks.

Tested Chrome and in Firefox and failed

Tested plugin as described on page and in demo. It loads all images and after they are loaded requests them again or does something strange, but it doesn't load them after page is loaded and they come into view.

Lazyload and isotope

OK I'm building a new portfolio for myself at http://www.gablabelle.com/ and I'm using your lazyload plugin with isotope to showcase my images. It works great when I scroll down the page but it seems like the images don't show up when filtering without having previously scrolled down. If i scroll down nothing happens.

It's acting like it doesn't consider the images to actually be in viewport (because of isotope).

If I put a high number to failure_limit (like 100 or 1000) it will actually show the images after filtering if I scroll a bit.

Is there something I can do to solve this?

Many thanks.

Multiple Events

Is it possible to trigger the load of images with multiple events? My page has a list of thumbnails which go below the fold that work perfectly with LazyLoad. On clicking each thumbnail, a hidden div becomes visible [which doesn't trigger the LazyLoad scroll event] and remains gray until the user scrolls the mouse a bit.

Any thoughts?

Cheers!

image from browser cache (when hiting refresh)

Hi,

<img class="lazy" data-original="/car.jpg" src="/loading.gif' />

When hitting the refresh button, the img's src is not changed to data-original value because the img src="loading.gif" returns 304 Not modified from browser cache.
Meaning that I have my spinner spinning over and over.

Lazyload and isotope

OK I'm building a new portfolio for myself at http://www.gablabelle.com/ and I'm using your lazyload plugin with isotope to showcase my images. It works great when I scroll down the page but it seems like the images don't show up when filtering without having previously scrolled down. If i scroll down nothing happens.

It's acting like it doesn't consider the images to actually be in viewport (because of isotope).

If I put a high number to failure_limit (like 100 or 1000) it will actually show the images after filtering if I scroll a bit.

Is there something I can do to solve this?

Many thanks.

Images not loading after ajax request in 1.8.3

After triggering an ajax request and then trying to call a method that finds all of my img.lazy DOM elements, no images are loaded. However, when doing the same methodology with 1.8.0, everything works fine, with the caveat of issue #80

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.