tags:

views:

137

answers:

1

Is there a way to pro grammatically scroll to the top of a page with jQuery? I am currently trying to do this with the following code but it is not working. I am using Firefox right currently,

$(window).scrollTop($(document).height());
+4  A: 

Try this:

$('html, body').animate({scrollTop: '0px'}, 300);

You can do this with 0 instead of 300 to be instant, but this gives a quick auto-scroll effect.

Nick Craver