function setButtonClass(offset){
var index = Math.abs(offset/600);
for(var i = 0;i<buttons.length;i++){
if(buttons[i].className){
buttons[i].removeAttribute('class');
break;
}
}
buttons[index-1].setAttribute('class','on');
}
在圆点切换的时候
next.onclick = function () {
index += 1;
index = index > 5 ? 1 : index;
showButton();
animate(-600);
}
prev.onclick = function () {
index -= 1;
index = index < 1 ? 5 : index;
showButton()
animate(-600);