jQuery 超屏加载,当文档超出屏幕的高度时,加载最新下个列数据
$(window).scroll(function () {var height = $(document).height(); //页面的高度var keheight = $(window).height(); //浏览器可视的高度var sheight = $(document).scrollTop(); //滚动的高度var num = $('.pro_list a').length;if (height <= keheight + sheight) {$.post('/index.php/ajax-addlist.html', { type: 'class', id: '102', num: num }, function (data) {if (data == '1') {$('.loading span').html('无更多数据...');} else {$('.pro_list').append(data);}//alert(data);});}});$(function () {var height = $(document).height(); //页面的高度var keheight = $(window).height(); //浏览器可视的高度if (keheight >= height) {$('.loading span').html('无更多数据...');}
});