jquery無縫間歇向上滾動

來源:互聯網
上載者:User

標籤:

 1 $(function(){ 2     var $this = $(".renav"); 3     var scrollTimer; 4     $this.hover(function(){ 5           clearInterval(scrollTimer); 6      },function(){ 7        scrollTimer = setInterval(function(){ 8                      scrollNews( $this ); 9                 }, 2000 );10     }).trigger("mouseout");11 });12 function scrollNews(obj){13    var $self = obj.find("ul:first");14    var lineHeight = $self.find("li:first").height();  15    $self.animate({ "margin-top" : -lineHeight +"px" },600 , function(){16          $self.css({"margin-top":"0px"}).find("li:first").appendTo($self);17    })18 }
Js Code
 1 <style type="text/css"> 2 .renav{ 3     width:200px; 4     height:150px; 5     line-height:21px; 6     overflow:hidden; 7     background:#FFFFFF; 8 } 9 .renav li{10     height:21px;11 }12 </style>13 <div class="renav">14     <ul style="margin-top: 0px;">15         <li><a>羅氏</a></li>16         <li><a>瑞聲達</a></li>17         <li><a>未添加1</a></li>18         <li><a>未添加2</a></li>19         <li><a>未添加3</a></li>20         <li><a>未添加4</a></li>21         <li><a>西門子</a></li>22         <li><a>歐姆龍</a></li>23     </ul>24 </div>
Html Code

 

jquery無縫間歇向上滾動

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.