



理想是火,点燃熄灭的灯。
JS内存泄露/垃圾回收/闭包 83
mongoDB排序操作超出内存限制的处理方法 449
CDN使用记录与配置 235
爬虫利器:jsDOM 455
模拟用户的Hover操作 389
Koa的上层框架egg.js的学习 326


function moveToBrowserBottom() {
let timerForDebounce = null; //为了防抖添加的timer
window.onscroll = function() {
if (timerForDebounce) clearTimeout(timerForDebounce);
var scrollTop =
document.documentElement.scrollTop ||
window.pageYOffset ||
document.body.scrollTop;
// gap是为了计算偏差,有时候会有1px的偏差值
let gap =
Math.ceil(document.documentElement.clientHeight + scrollTop) -
document.documentElement.scrollHeight;
if (
document.documentElement.scrollHeight ===
Math.ceil(document.documentElement.clientHeight + scrollTop) ||
gap === 1
) {
timerForDebounce = setTimeout(() => {
console.log("触底了");
}, 200);
}
};
}
作者: Bill 本文地址: http://biaoblog.cn/info?id=1608281280000
版权声明: 本文为原创文章,版权归 biaoblog 个人博客 所有,欢迎分享本文,转载请保留出处,谢谢!
上一篇:git操作日常记录学习