var olist = $('.list');
setInterval(function(){
var nleft = parseInt($('.list')[0].style.left) - 600;
olist.animate({left:nleft}, 400, function(){
if(nleft <= -2400 ){
nleft = '-600px';
}
else {
nleft = nleft + 'px';
}
$('.list')[0].style.left = nleft;
})
},2000)
setInterval(function(){
var nleft = parseInt($('.list')[0].style.left) - 600;
olist.animate({left:nleft}, 400, function(){
if(nleft <= -2400 ){
nleft = '-600px';
}
else {
nleft = nleft + 'px';
}
$('.list')[0].style.left = nleft;
})
},2000)
2017-02-20
最新回答 / stormchou
可以这样试试index += 1; if (index > 5) { index = 1; }index -= 1; if (index < 1) { index = 5; }
2017-02-18
最新回答 / 微小唯
myIndex=this.getAttribute('index') 写成myIndex=parseInt(this.getAttribute('index'))就可以了
2017-02-17