Last active
December 23, 2015 13:59
-
-
Save fiture/6645811 to your computer and use it in GitHub Desktop.
兼容IE的Image loaded.
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
function loadImage(src, $img) { | |
var me = arguments.callee; | |
$img | |
.load(function(){ | |
if ( $img.width() && $img.height() ) { | |
//获取宽度 | |
} else { | |
//延时,递归再次调用 | |
setTimeout(function(){ | |
me(src, $img); | |
} , 500); | |
} | |
}) | |
.error(errorHandler); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment