如何使用JavaScript / jQuery滚动到页面顶部?
示例
<html>
<body>
<script>
$("a").click(function() {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
</script>
<h3>TOP OF PAGE</h3>
<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.<br>
This is demo text.
<br>
<h3>BOTTOM OF PAGE</h3>
<a href="#">Scroll up</a>
</body>
</html>热门推荐
6 敏字的祝福语简短
10 60岁长辈祝福语简短
11 预祝高尔夫的祝福语简短
12 新年祝福语简短创意兄弟
13 横幅元旦祝福语大全简短
14 生日祝福语男孩 简短独特
15 毕业结婚祝福语简短精辟
16 新年简短的英文祝福语
17 邻居女儿嫁人祝福语简短
18 新年祝福语长辈简短红包