I am currently using Jquery Lazy Load and I was wondering if there is a way of making a callback when all the images from my container ended loading (when lazy load has made all his magic).
The reason for this is that I am using jScrollPane Plugin as well and I would like to call the jScrollPane reinitialize function.
Thanks'
In order to process on last image loaded and run code only and only when it's finished (all images loaded), you must use your handler function, as VAShhh told before, unlike the function call should only send 2 parameters, so this function is invoked with javascript call statement.
Then you will be able to successfully retrieve the "elements_left" parameter and compare it to 0 (zero): last loaded image left. Something like this:
Please check this example at: jsfiddle.net/eRyww/4
Looking at the source, it seems that the lazy load plugin calls the
settings.load
function after loading an image passing the loaded image element and a couple of parameters:So you will probably need to just set something like this:
If you want to be sure that the image is loaded, you can attach a listener to the loaded image:
Edit
After trying the code, the most 'clean' method is to attach to the
.load
method of your images:http://jsfiddle.net/eRyww/72/
As an alternative answer I have created a "lazy load" plugin that will do just that. It offers a callback after all elements have loaded. It's a little different and not quite just for images but anytime selected elements come into view of the browser view pane.
https://github.com/shrimpwagon/jquery-lazyloadanything