问答详情
源自:3-3 bug解决及定时器优化

//除了@zhiqixie 说的, 还应该加 上
//鼠标移动到内容上停止自动切换
   $('notice-con').onmouseover=function(){
      clearInterval(timer);
   }
   $('notice-con').onmouseout=function(){  
      timer=setInterval(autoPlay,2000); 
   }


提问者:汪星人陈达 2014-09-05 13:13

个回答

  • 空白色的纯
    2016-04-27 18:39:51

    //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);
            }
        }

    //内容

        for (var j = 0; j < divs.length; j++) {
            divs[j].onmouseover = function() {
                clearInterval(timer);
            }
            divs[j].onmouseout = function() {
                timer = setInterval(autoPlay,2000);
            }
        }


    //这样写不能简化语句,

  • summerstarry
    2015-03-13 17:23:54

    aDiv[i].onmouseover = function ()
                    {
                        clearInterval(timer);
                    };
                    我直接就这么关闭了