高度
滚动条距离顶部的高度
浏览器窗口的高度
网页的实际高度
参考滚动到某一位置加载新内容的高度
<script type="text/javascript">
var gPage = 1;
var gRequestPageTimer = null;
var gIsRequestPage = 1;
$(function(){
$(window).scroll(function(){
var scrollTop = $(this).scrollTop(); //滚动条距离顶部的高度
var windowHeight = $(this).height();//浏览器窗口的高度
var documentScrollHeight = $(document).height();//网页的实际高度
var footerHeight = $("#footerApp").height();//参考滚动到某一位置加载新内容的高度
var requestPageHeight = documentScrollHeight - footerHeight - windowHeight;
//var requestPageHeight = documentScrollHeight - windowHeight;
if(scrollTop >= requestPageHeight && gIsRequestPage == 1){
gIsRequestPage = 0;
if(gPage >= confMyListApp.confMyPage.pageCount){
$("#pageLodingOver").removeClass('acu-display-none').addClass('acu-display-block');
return;
}
gPage = gPage + 1;
if(gRequestPageTimer){
clearTimeout(gRequestPageTimer);
}
gRequestPageTimer = setTimeout(
function(){
$.get('../db/conf.php?act=init&load_all=0&page='+gPage,function(data){
dataObj = eval('('+data+')');
confMyListApp.confMyArr = confMyListApp.confMyArr.concat(dataObj.data);
gIsRequestPage = 1;
$("#pageLoding").removeClass('acu-display-block').addClass('acu-display-none');
});
},200);
}
});
});
</script>