javascript - Image onload event not firing in firefox -


i'm creating image preloader. works fine in browsers except firefox (testing firefox 10.0). input array of images called image_list. these images appended dynamically body of document , load callback attached, calls function update_progress. code follows:

$(image_list).each(function() {       var x = $('<img />')        .load(function() {update_progress(percent_loaded += step);})        .attr('src', this)        .appendto('body')        .css('display', 'none');        .each(function() {           if(this.complete)              update_progress(percent_loaded += step);       }); }); 

in firefox, load callback , update_progress never called. yet exact same code works fine in chrome , other browsers i've tested. there way detect when image has loaded in firefox?

i first check see whether image has height, checking height property.

if (the_image.height > 0) {   // image loaded (possibly cached) } 

if have cached images, etc, should around that.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -