搜索 |
.loading{
position: fixed;
left: 0;
top: 0;
height: 10px;
background: red;
z-index: 19890414;
}
?
$(function(){
var img=$("img"),num=0;
img.each(function(i){
var oImg=new Image();
oImg.src=$("img:eq("+i+")").attr("src");
oImg.onload=function(){
var per=(++num)/img.length*100+"%";
$(".loading").animate({"width":per},1);
if(per=="100%"){
$(".loading").fadeOut()
}
}
})
})