css代码:
1 2 3 4 | ul#portfolio{margin:0;padding:0;}
ul#portfolio li{float: left;margin:0 5px 0 0;width:250px;height: 250px;list-style: none;}
ul#portfolio li.loading{background: url(../images/spinner.gif) no-repeat center center;}
ul#portfolio li img{width:250px;height: 250px;display: block;}
|
Salin selepas log masuk
js代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | $( function (){ var images= new Array();
images[0]= './images/ads_one.jpg' ;
images[1]= './images/ads_two.jpg' ;
images[2]= './images/ads_three.jpg' ;
}
if (index<max){
var list=$('<li id= "portfolio_'+index+'" ></li> ').attr(' class ',' loading');
$(this).css( 'display' , 'none' );
$(curr).removeClass( 'loading' ).append(this);
$(this).fadeIn( 'slow' , function (){
});
}).error( function (){
$(curr).remove();
LoadImage(index+1,max);
}).attr( 'src' ,images[index]);
}
}
})
|
Salin selepas log masuk
Atas ialah kandungan terperinci jquery实现图片依次加载实例代码. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!