function scrollTop () { return Math.max( // chrome document.body.scrollTop, // firefox/IE document.documentElement.scrollTop) } function documentHeight () { // 现代浏览器(IE9+和其他浏览器)和IE8的document.body.scrollHeight和document.documentElement.scrollHeight都可以 return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight) } function windowHeight () { return (document.compatMode == 'CSS1Compat') ? document.documentElement.clientHeight : document.body.clientHeight } // 上拉加载更多 var winH = $(window).height() var checkTimer $(document).scroll(function () { clearTimeout(checkTimer) checkTimer = setTimeout(function () { if (scrollTop() + windowHeight() >= (documentHeight() - 50)) { // 滚动分页ajax请求写在里面 } }, 200) })
滚动加载分页 上拉分页
最新推荐文章于 2024-06-06 09:45:56 发布