鼠標(biāo)進(jìn)入停止
carousel.onmouseover = function(){
clearInterval(timer);
}
鼠標(biāo)離開開始
~~~ carousel.onmouseout = function(){
timer = setInterval(rightBtnHandler,interval);
}~~~
按鈕的監(jiān)聽
~~~rightBtn.onclick = rightBtnHandler;
function rightBtnHandler(){
if(lis[idx].isanimated) return;
animate(lis[idx],{"opacity" : 0},1000);
idx++;
if(idx > imgLength - 1){
idx = 0;
}
animate(lis[idx],{"opacity" : 1},1000);
changeCircle();
}~~~
小圓點(diǎn)的監(jiān)聽
~~~for(var i = 0 ; i <= imgLength - 1 ; i++){
circlesLi[i].index = i;
circlesLi[i].onclick = function(){
if(lis[idx].isanimated) return;
animate(lis[idx],{"opacity" : 0},1000);
idx = this.index;
animate(lis[idx],{"opacity" : 1},1000);
changeCircle();
}
}~~~
更換小圓點(diǎn)函數(shù)
~~~function changeCircle(){
for (var i = 0; i < circlesLi.length; i++) {
circlesLi[i].className = "";
}
circlesLi[idx].className = "cur";
}~~~
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者