/ Published in: HTML
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<html> <head> <meta content=""> <script type="text/javascript"> $(function(){ var sc = {}; sc.container = jQuery(".news-container"); sc.items = $("#newslist li"); sc.cle = 1; sc.timer = null; sc.scrollTimed = function(){ sc.container.scrollTo(sc.items[sc.cle], 600); sc.cle == sc.items.length -1 ? sc.cle = 0 : sc.cle++; }; sc.start = function(){ sc.timer = setInterval(function(){sc.scrollTimed()}, 2000); }; sc.stop = function(){ clearInterval(sc.timer); }; sc.container.mouseover(function(){sc.stop();}).mouseout(function(){sc.start()}); sc.start(); }); </script> <style> .news-container{ height: 195px; overflow: hidden; width: 351px;} </style> </head> <body> <div class="news-container"> <ul id="newslist" class="news_list"> <li> </li> <li> </li> <li> </li> <li> </li> <li> </li> </ul> </div> </body> </html>