手机端网页滑动触发分页
window.addEventListener('scroll', handleScroll);var page = 1;function handleScroll(arg) {var clientHeight = document.documentElement.clientHeight;//客户区高度var scrollHeight = document.documentElement.scrollHeight;//没滚动下原内容高度var scrollTop = document.documentElement.scrollTop;//被隐藏区域上方的像素if (scrollTop + clientHeight == scrollHeight) {page++;console.log("加载新分页数据" + page);//TODO 加载新的数据return;}console.log("高度变化:", clientHeight, scrollHeight, scrollTop);}
网页下滑触发分页加载新的内容