var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
var end = 0;
var change = end - scrollTop;
var t = 0;
var maxT = 30;
var timer = setInterval(function() {
t++;
if(t>=maxT) {
clearInterval(timer);
}
document.body.scrollTop = Tween.Bounce.easeOut(t,scrollTop,change,maxT);
document.documentElement.scrollTop = Tween.Bounce.easeOut(t,scrollTop,change,maxT);
},17)
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)