js无限轮播的写法
js實現輪播很簡單,無限輪播也不是很難,掌握技巧就很簡單了。
$(document).ready(function(){
var x=0;
var itime;
var newshop=function(){
if (x%3==1) {
$('#shopDiv').animate({'margin-left':-1842.5},1500);
clearTimeout(itime);
itime=setTimeout(function(){newshop();x++;}, 6500);
}else if(x%3==2){
$('#shopDiv').animate({'margin-left':0},0);
clearTimeout(itime);
itime=setTimeout(function(){newshop();x++;}, 0);
}else if(x%3==0){
$('#shopDiv').animate({'margin-left':-922},1500);
clearTimeout(itime);
itime=setTimeout(function(){newshop();x++;}, 6500);
}
}
itime=setTimeout(function(){newshop();x++;}, 5000);
$('#shopDiv').mouseover(function(){
clearTimeout(itime);
})
$('#shopDiv').mouseleave(function(){
clearTimeout(itime);
itime=setTimeout(function(){newshop();x++;}, 3000);
})
})
轉載于:https://www.cnblogs.com/webwangjie/p/7403873.html
總結
- 上一篇: 查看表扫描次数,并对比索引对表查询的作用
- 下一篇: 智慧城市不是“交钥匙”工程 信息技术是根