jQuery callback on image load (even when the image is cached) - Stack Overflow If the src is already...

Please Visit: http://ift.tt/1ajReyV



jQuery callback on image load (even when the image is cached) - Stack Overflow

If the src is already set then the event is firing in the cache cased before you get the event handler bound. To fix this, you can loop through checking and triggering the event based off .complete, like this:

$("img").one('load', function() {

// do stuff

}).each(function() {

if(this.complete) $(this).load();

});

Note the change from (Link->http://ift.tt/1imhxZN) so the event handler doesn't run twice.

http://ift.tt/1imhxcm

http://ift.tt/1imhxZT



jQuery callback on image load (even when the image is cached) - Stack Overflow







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1imhxcn

via LifeLong Community

No comments:

Post a Comment