JavaScript滑动页面到顶部

// 页面滚动到顶部
// 方法一
document.body.scrollTop=document.documentElement.scrollTop=0
// 方法二
document.body.scrollIntoView()

// scrollIntoView 是元素也有的方法, 可以用在页面元素上,例如
document.getElementById('id').scrollIntoView()

JavaScript滑动页面到顶部的方法。

原文地址:https://www.cnblogs.com/wanlibingfeng/p/11899195.html