基于jQuery實現(xiàn)的單行公告活動輪播效果
更新時間:2017年08月23日 14:49:07 作者:MoleKing
本文通過實例代碼給大家介紹了基于jQuery實現(xiàn)的單行公告活動輪播效果,非常不錯,代碼簡單易懂,具有參考借鑒價值,需要的的朋友參考下吧
廢話不多說了,直接給大家貼代碼了,具體代碼如下所示:
<div class="lunbo123" style="position:relative;height: 45px;overflow: hidden;background-color:white" ;> <ul id="myul" style="margin:6px;padding:0px;position:absolute;width: 700px; height: auto;"> <li> <a href="" style=" rel="external nofollow" rel="external nofollow" text-decoration: none;color: #000000; "> <span style="height:36px ; line-height: 36px;">公告test1 </span> </a> </br> </li> <li> <a href="" style=" rel="external nofollow" rel="external nofollow" text-decoration: none;color: #000000; "> <span style="height:36px ; line-height: 36px;">活動test2 </span> </a> </br> </li> </ul> </div> <script src="http://cdn.bootcss.com/jquery/2.2.2/jquery.js"></script> <script> function lunbo123(id, height) { var ul = $(id); var liFirst = ul.find('li:first'); $(id).animate({ top: height }).animate({ "top": 0 }, 0, function() { var clone = liFirst.clone(); $(id).append(clone); liFirst.remove(); }) } setInterval("lunbo123('#myul','-45px')", 2500) </script> <style> #myul { list-style-type: none; width: 300px; height: 45px; font-size: 20px; } </style>
總結(jié)
以上所述是小編給大家介紹的基于jQuery實現(xiàn)的單行公告活動輪播效果,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
jQuery的Scrollify插件實現(xiàn)滑動到頁面下一節(jié)點
這篇文章主要介紹了jQuery的Scrollify插件實現(xiàn)滑動到頁面下一節(jié)點的相關(guān)資料,需要的朋友可以參考下2015-07-07