来源:3-3 bug解决及定时器优化

汪星人陈达

2014-09-05 13:13

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


写回答 关注

2回答

  • 空白色的纯
    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);
                    };
                    我直接就这么关闭了


Tab选项卡切换效果

本课程详细介绍网页页面中最流行常用的tab切换效果

65466 学习 · 581 问题

查看课程

相似问题

回答 4

回答 1

回答 1

回答 2

回答 3