toTop() { let top = document.documentElement.scrollTop || document.body.scrollTop; // 实现滚动效果 const timeTop = setInterval(() => { document.body.scrollTop = document.documentElement.scrollTop = top -= 50; if (top <= 0) { clearInterval(timeTop); } console.log(document.documentElement.scrollTop); }, 10);
原文地址:https://www.cnblogs.com/xiaozhang666/p/11433825.html
时间: 2024-11-04 12:06:21