views:

102

answers:

2

How would I make the window snap to the top of the page on an event in jquery?

+1  A: 

This scrolls the window to the top of the page, if that's what you're after...

window.scrollTo(0,0);
El Yobo
+1  A: 

I would suggest (edited based on @Aaron's comment):

$("html, body").scrollTop(0);

http://api.jquery.com/scrollTop/

karim79
Note that this doesn't work for some browsers. If it doesn't, use `$("body")` (or scroll both just to be sure).
Aaron Digulla