I'm trying to create a simple breaking news bar with continuously moving text. A single string of text moving and looping forever, and only stopping on hover. Do you know of any script like that? I've searched a lot but couldn't find one.
Cheers
So far I have this:
<script type="text/javascript">
$(function() {
var ele = $('#scroll');
var speed = 25, scroll = 5, scrolling;
$('#scroll-up').mouseenter(function() {
// Scroll the element up
scrolling = window.setInterval(function() {
ele.scrollLeft( ele.scrollLeft() - scroll );
autoPlay: true;
}, speed);
});
$('#scroll-down').mouseenter(function() {
// Scroll the element down
scrolling = window.setInterval(function() {
ele.scrollLeft( ele.scrollLeft() + scroll );
autoPlay: true;
}, speed);
});
$('#scroll-up, #scroll-down').bind({
click: function(e) {
// Prevent the default click action
e.preventDefault();
},
mouseleave: function() {
if (scrolling) {
window.clearInterval(scrolling);
scrolling = false;
}
}
});
});
</script>
Now I want to make it automatic, and make it loop infinitely. Any help?