Reputation: 793
I need a very simple jQuery to constantly scroll a list of text items up without using a plugin. I know this is probably fairly simple but I can't find an example that I can use and I have already spent too much time on it at work.
No parameters will need to be changed by mouse hover or button click, so everything can be ran within document.ready and never touched again. My only request is that, ideally, it should be constantly looped.
Upvotes: 0
Views: 2947
Reputation: 645
wrote a jquery plugin for this just now.
$('.scrolling-div').rollup({speed:2000});
Upvotes: 2
Reputation: 19022
In short:
function cycle($item, $cycler){
setTimeout(cycle, 2000, $item.next(), $cycler);
$item.slideUp(1000,function(){
$item.appendTo($cycler).show();
});
}
cycle($('#cycler div:first'), $('#cycler'));
With #cycler
being the container with the div
s that are to be cycled. See demo.
Upvotes: 4
Reputation: 92893
Basic code that will work, but stops at the bottom:
setInterval(function() {
var $c = $('#container');
$c.scrollTop($c.scrollTop() + 1)
}, 100);
I'm not sure what you mean by "constantly looped".
Upvotes: 1