手机下拉最底部加载更多数据

$(document).ready(function(){ 
var range = 0; //距下边界长度/单位px  
 
var num = 1;  
var totalheight = 0;  
var main = $("#content"); //主体元素  
$(window).scroll(function(){  
var srollPos = $(window).scrollTop(); //滚动条距顶部距离(页面超出窗口的高度)  
totalheight = parseFloat($(window).height()) + parseFloat(srollPos);  
if(($(document).height()-range) <= totalheight ) {  
     
     $.post("1.php",{p:num},function(result){
                        main.append(result);  
                     });
                     
num++;  
}  
});  
});  
 

标签: js

评论已关闭