//滚动加载更多
$(window).scroll(
function() {
var scrollTop = $(this).scrollTop();//返回或者设置匹配元素的滚动条的位置
//我们要知道,$(window).height(),获取的是窗口的可视区域的高度,而$(document).height();获取的是文档的高度。
var scrollHeight = $(document).height();//获取文档的高度
var windowHeight = $(this).height();
if (scrollTop + windowHeight == scrollHeight) {
submit();//调用加载更多
}
}
var page = 1;
function submit(){
page++;
$.ajax({
type:'GET',
url:'/index.php/Mobile/User/bb_age',//ajxa请求地址
success:function(data){
if($.trim(data)==''){
$('#mmm').show();//如果为空,则显示被隐藏“数据已加载完毕”
return false;
}else{
$('.hhhh').append(data);//追加数据
}
}
});
}
</script>
$(window).scroll(
function() {
var scrollTop = $(this).scrollTop();//返回或者设置匹配元素的滚动条的位置
//我们要知道,$(window).height(),获取的是窗口的可视区域的高度,而$(document).height();获取的是文档的高度。
var scrollHeight = $(document).height();//获取文档的高度
var windowHeight = $(this).height();
if (scrollTop + windowHeight == scrollHeight) {
submit();//调用加载更多
}
}
);
<script>var page = 1;
function submit(){
page++;
$.ajax({
type:'GET',
url:'/index.php/Mobile/User/bb_age',//ajxa请求地址
success:function(data){
if($.trim(data)==''){
$('#mmm').show();//如果为空,则显示被隐藏“数据已加载完毕”
return false;
}else{
$('.hhhh').append(data);//追加数据
}
}
});
}
</script>