You can use something like this.
//run instantly and then goes after (setTimeout interval) $("html, body").animate({ scrollTop: $(document).height() }, 4000); setTimeout(function() { $('html, body').animate({scrollTop:0}, 4000); },4000); var scrolltopbottom = setInterval(function(){ // 4000 - it will take 4 secound in total from the top of the page to the bottom $("html, body").animate({ scrollTop: $(document).height() }, 4000); setTimeout(function() { $('html, body').animate({scrollTop:0}, 4000); },4000); },8000); โ//Use this to stop the scroller -> clearInterval(scrolltopbottom);
Example: http://jsfiddle.net/NaP8D/11/
source share