这处的if判断不大懂,speed正负和新left和原left值比较这一大串不就相当于偏移量存在嘛
function go(){ //变化图片动画效果 if ((speed<0&&parseInt(list.style.left)>newLeft) ||speed>0&&parseInt(list.style.left)<newLeft) { list.style.left = parseInt(list.style.left)+speed+"px"; setTimeout(go,interval); //在位移时就给予动画效果 }else { change = false; //切换完毕后可继续切换 list.style.left = newLeft + "px"; if (newLeft > -600) { list.style.left = -3000 + "px"; } if (newLeft < -3600) { list.style.left = -1200 + "px"; } } }