var a = {
init:function(){
this.initDom();
this.handleImg();
},
initDom:function(){
this.time_img;
this.isLoad = true;
},
doSomething:function(){},
isImgLoad: function (callback) {
var _self = this;
$('.lp-left img').each(function(index,element){
if($(element).height() === 0){
_self.isLoad = false;
return false;
}
});
if(_self.isLoad){
clearTimeout(_self.time_img);
callback();
}else{
_self.isLoad = true;
_self.time_img = setTimeout(function(){
_self.isImgLoad(callback);
},500);
}
},
handleImg: function(){
var _self = this;
_self.isImgLoad(_self.doSomething);
}
};
这个兼容性什么的比较好,当然JQ的load()函数也是可以的~~~