关于新闻滚动问题,鼠标悬浮上去,不停止滚动

 <div id="demos" style="overflow: hidden;width: 100%;">
          <div id="indemos" style="float: left;width: 800%; ">
            <div id="demos1" style="float: left">
                <asp:Repeater ID="rpt_lylist" runat="server">
                    <ItemTemplate>
                         <a href="javascript:void(0)" target="_blank" title='<%#Eval("title") %>'>
                             [<%#Eval("title").ToString().Length > 16 ? Eval("title").ToString().Substring(0, 16) + ".." : Eval("title") %>]
                         </a>
                   
                    </ItemTemplate>
                </asp:Repeater>
          
            </div>
            <div id="demos2" style="float: left;"></div>
          </div>
        </div>
        <script type="text/javascript">
          var speed=30;
          var tabs=document.getElementById("demos");
          var tabs1=document.getElementById("demos1");
          var tabs2=document.getElementById("demos2");
          tabs2.innerHTML=tabs1.innerHTML;
         
          function Marquee(){
              if(tabs2.offsetWidth-tabs.scrollLeft<=0)
                 tabs.scrollLeft-=tabs1.offsetWidth;
              else{
                 tabs.scrollLeft++;
              }
          };

          var MyMar=setInterval(Marquee,speed);
          tabs.onmouseover=function() {
               clearInterval(MyMar);
          }
          tabs.onmouseout=function() {MyMar=setInterval(Marquee,speed);}
      </script>

红糖糍粑
浏览 444回答 1
1回答

神不在的星期二

悬浮上去,不停止滚动,把 tabs.onmouseover=function() {  clearInterval(MyMar); } 这段话里面的  clearInterval(MyMar);注释掉即可, 修改为: tabs.onmouseover=function() {   //clearInterval(MyMar);  } 
打开App,查看更多内容
随时随地看视频慕课网APP