-1

Is it possible to force Lazy Load to 'preload' an invisible image that is connected with the Lazy Load Plug-In? So that wehen the image get's visible, it's already loaded.

I've found only events that need an interaction like mouseover or click, but no event for my custom script that don't relies on user events.

$("img.lazy").lazyload({ 
event : "click"
});
borzo
  • 1
  • 1
  • 1

1 Answers1

-4

Found a solution here:

http://sumanrs.wordpress.com/2011/02/08/jquery-lazy-loading-images-no-scrolling/

insert in your (e.g. click) function this:

$("img.lazy").each(function() {
   $(this).attr("src", $(this).attr("data-original"));
   $(this).removeAttr("data-original");
});
borzo
  • 1
  • 1
  • 1
  • 4
    This is totally wrong. Code above loads all images immediately and basically nullifies any positive effect Lazy Load plugin has. Lazy Loading is exact opposite of preloading. Lazy Loading means loading a resource only when it is needed. Preloading means loading a resource into cache before it is needed. – Mika Tuupola Aug 15 '12 at 10:12