JS判断图片是否加载完毕
/**
* @function Determine if the image has been loaded.
* @param img,callback
*/
function imgIsLoaded(img, callback) {
var timer = setInterval(function () {
if (img.complete) {
callback(img)
clearInterval(timer)
}
}, 50)
}