Skip to content

Instantly share code, notes, and snippets.

@boostbob
Created June 5, 2013 16:02
Show Gist options
  • Save boostbob/5715065 to your computer and use it in GitHub Desktop.
Save boostbob/5715065 to your computer and use it in GitHub Desktop.
foundation interchange ie load callback fix
loaded : function (image, last, callback) {
function loaded () {
callback(image[0], last);
}
function bindLoad () {
this.one('load', loaded);
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
var src = this.attr( 'src' ),
param = src.match( /\?/ ) ? '&' : '?';
param += 'random=' + (new Date()).getTime();
this.attr('src', src + param);
}
}
if (!image.attr('src')) {
loaded();
return;
}
if (image[0].complete || image[0].readyState === 4) {
loaded();
} else {
bindLoad.call(image);
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment