Revision: 15131
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 25, 2009 12:35 by dougunderscorenelson
Initial Code
$("img").each(function(){ i = $(this).attr('src'); $(this).attr('src','') $(this).load(function(){ $(this).data('loaded','true'); }); $(this).attr('src',i); });
Initial URL
Initial Description
Used this on a project to determine whether images were loaded or not. In an image carousel, for example, you could test the next/clicked image before advancing the slide, and if 'loaded' wasn't 'true', you could add a "loading" class and attach a new .load handler to remove the class and advance when the image finished loading.
Initial Title
Has the image loaded?
Initial Tags
image, jquery
Initial Language
jQuery