2019独角兽企业重金招聘Python工程师标准>>>
/*
*下拉加载更多使用
*底部小于50返回false--加载,否则不加载
* */
function lowEnough(){var pageHeight = Math.max(document.body.scrollHeight,document.body.offsetHeight); //页面高度var viewportHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0; //可视区域高度var scrollHeight = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; //网页被卷去的高return pageHeight - viewportHeight - scrollHeight < 50;
}
当滚动距离小于50时,就加载新的数据,否则不加载,异步加载