//除了@zhiqixie 說的, 還應(yīng)該加 上 //鼠標(biāo)移動到內(nèi)容上停止自動切換 $('notice-con').onmouseover=function(){ clearInterval(timer); } $('notice-con').onmouseout=function(){ timer=setInterval(autoPlay,2000); }

汪星人陳達
2014-09-05
2 回答
舉報
0/150
提交
取消
2016-04-27
//tab欄
for (var i = 0; i < lis.length; i++) {
?? ??? ?lis[i].id = i;
?? ??? ?lis[i].onmouseover = function() {
?? ??? ??? ?clearInterval(timer);?? ??? ?
?? ??? ??? ?changeOption(this.id);?? ?
?? ??? ?}
?? ??? ?lis[i].onmouseout = function() {
?? ??? ??? ?timer = setInterval(autoPlay, 2000);
?? ??? ?}
?? ?}
//內(nèi)容
??? for (var j = 0; j < divs.length; j++) {
?? ??? ?divs[j].onmouseover = function() {
?? ??? ??? ?clearInterval(timer);
?? ??? ?}
?? ??? ?divs[j].onmouseout = function() {
?? ??? ??? ?timer = setInterval(autoPlay,2000);
?? ??? ?}
?? ?}
//這樣寫不能簡化語句,
2015-03-13