[jQuery] basic news ticker
Hi there,
I'm trying to write a news ticker script that horizontally slides 1
item from right to left in a box. Most news ticker scripts use
multiple items for this, but my needs are somewhat different.
Well I've kinda got it working, except for when I hover over it. Then
when the cursor goes away, the speed's been affected as well as the
item stops ticking by. Here is my code:
$(document).ready(function() {
function scroller() {
$('#newsticker ul li').animate(
{left: "-200px"},
2000,
"linear",
function(){
$(this).css("left", "200px");
scroller();
}
)
.hover(
function(){
jQuery(this).stop()
},
function(){
$(this).css("left", 200 - $(this).position().left);
scroller();
});
};
scroller();
});