使用 jquery animate 滚动到页面顶部
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16334874/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Scroll to top of the page using jquery animate
提问by Narendra Bista
I want to put to the top bottom of the page which should scroll the page to the top. However I want the scrolling process to have animated effect. I think it is possible by using animate but have no idea how to ?
我想放在页面的顶部底部,应该将页面滚动到顶部。但是我希望滚动过程具有动画效果。我认为使用 animate 是可能的,但不知道如何使用?
Please help. Thanks
请帮忙。谢谢
回答by Paras
回答by pai.not.pi
You can animate the scrollTop
property of the html, body
您可以动画的scrollTop
属性html, body
$('html, body').animate({
scrollTop: "0px"
}, 800);
I suggest you do some research/reading before you ask trivial questions like these. Google can help you out before all of us can.
我建议你在问这些琐碎的问题之前先做一些研究/阅读。Google 可以先于我们所有人为您提供帮助。