[jQuery] News scroller/ticker with jQuery?

[jQuery] News scroller/ticker with jQuery?

Excellent - just what I was looking for. Thanks.
Luc Pestille
Web Designer
e: luc.pestille@in2.co.uk
t: +44 (0)1628 899 700
f: +44 (0)1628 899 701
-----Original Message-----
From: discuss-bounces@jquery.com [mailto:discuss-bounces@jquery.com] On
Behalf Of sunsean
Sent: 11 July 2006 16:55
To: jQuery Discussion.
Subject: Re: [jQuery] News scroller/ticker with jQuery?
Hi Luc, here's some code to get you started.
HTML:
<ul id="ticker">
<li>News Item 1</li>
<li>News Item 2</li>
<li>News Item 3</li>
</ul>
JAVSCRIPT (latest jQ):
var newsitems;
var curritem=0;
$(document).ready(function(){
newsitems = $("#ticker li").hide().size();
$("#ticker li:eq("+curritem+")").show();
setInterval(ticknews,2000); //time in milliseconds });
function ticknews() {
$("#ticker li:eq("+curritem+")").hide();
curritem = ++curritem%newsitems;
$("#ticker li:eq("+curritem+")").show(); }
Let me know if you have any questions.
~Sean