var index = 0;
var animate = function(offset){
return function(){
var left = parseInt(list.style.left) + offset/10;
list.style.left = left + 'px';
if(left == 0) list.style.left = -3000 + 'px';
alert(index);
if(left == index*-600) clearInterval(interval);
}
}
prev.onclick = function(){
interval = setInterval(animate(600),100);
index --;
if(index<0) index = 4;
}为什么输出的 index为4??不是还没clearInterval吗??下面的语句就被执行了??
添加回答
举报
0/150
提交
取消