Created
June 5, 2013 16:02
-
-
Save boostbob/5715065 to your computer and use it in GitHub Desktop.
foundation interchange ie load callback fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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