开发者

Why to scroll webpage to top, i need to scroll the $("html")

开发者 https://www.devze.com 2023-01-06 11:55 出处:网络
i am referencing the code from snipplr $(\'html, body\').animate({scrollTop:0}, \'slow\'); i found out actually i need to use $(\'html\'), $(\'body\') does not work, $(\'html, body\') seems redunda

i am referencing the code from snipplr

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

i found out actually i need to use $('html'), $('body') does not work, $('html, body') seems redundant开发者_开发技巧?


According to this blog post (update 4) it's because html works for IE in standards mode and body works in quirks mode.

0

精彩评论

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

关注公众号