开发者

Snap to top of window in jquery

开发者 https://www.devze.com 2022-12-26 06:41 出处:网络
How would I make the 开发者_运维百科window snap to the top of the page on an event in jquery?This scrolls the window to the top of the page, if that\'s what you\'re after...

How would I make the 开发者_运维百科window snap to the top of the page on an event in jquery?


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

window.scrollTo(0,0);


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

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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消