http://jsfiddle.net/uaewc/453/
function animateList() {
$('#listofstuff').animate({
scrollTop: scrollAmount
}, 1000, function() {
lastElement.addClass('current-last');
setTimeout(function() {
$('#listofstuff').animate({
scrollTop: 0
}, 1000,function() {
setTimeout(function() {
animateList();
},1000);
});
},1000);
});
}
animateList();
Is that what you wanted?
If you wrap your code in a function you can call it again once the animation has completed.