标签:结束 etl scroll tle UNC fun element java mat
计算容器距离屏幕顶部的距离,用容器距离文档顶部的距离减去页面被卷起的高度
dom元素.offsetTop - Math.max(document.documentElement.scrollTop, document.body.scrollTop);
// from: 滚动开始点, to: 滚动结束点
function backTop (from, to) {
var t = setInterval(function () {
from /= 1.1;
if (from < 0.5) {
from = to;
clearInterval(t);
}
document.body.scrollTop = document.documentElement.from = from;
}, 16.7);
}
标签:结束 etl scroll tle UNC fun element java mat
原文地址:https://www.cnblogs.com/Yancyzheng/p/10676006.html