Published in: jQuery
|
|
|
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.
Expand |
Embed | Plain Text
$("img").each(function(){ i = $(this).attr('src'); $(this).attr('src','') $(this).load(function(){ $(this).data('loaded','true'); }); $(this).attr('src',i); });
You need to login to post a comment.

