let intval = setInterval(() => {
var imgList=$('img');//选中全局img
var imgStatus=true;//判断状态
for(let i=0;i<imgList.length;i++){
if(imgList[i].complete){ //jquery选中的图片会有complete状态,为true就是加载完成,为false就是加载失败
}else{
imgStatus=false
}
}
if(imgStatus){//全部图片加载完成
that.loadStatus=false;
clearInterval(intval)//清除扫描
return
}
}, 1000)//每隔一秒扫描一次
jquery确定全局图片都加载完成
最新推荐文章于 2024-03-01 11:30:53 发布