Skip to content

Instantly share code, notes, and snippets.

@msikma
Created November 3, 2014 13:27
Show Gist options
  • Save msikma/2a23f3c3a7fb5da49d86 to your computer and use it in GitHub Desktop.
Save msikma/2a23f3c3a7fb5da49d86 to your computer and use it in GitHub Desktop.
jQuery Image load callback (IE6 compatible)
// requires jQuery 1.x
// image load callback that is compatible with IE6
var $img = $('.some-selector img');
var isIE6 = jQuery.browser.msie && parseInt(jQuery.browser.version) == 6;
$img.one("load", function()
{
/*
image load event code goes here
*/
}).each(function()
{
if (this.complete || (isIE6)) {
$(this).trigger("load");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment