页面下拉加载更多数据(spring MVC)
var SEE_MORE={p:1,loading:false,hasData:true}; //下拉到底 js 判断 $(window).scroll(function () { loadData(); }); function loadData() { totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop()); if ($(document).height() <= totalheight +300) { //下啦加载时运行 loadmore(); } } <%//加载更多 %> function loadmore(){ if(!SEE_MORE.loading&&SEE_MORE.hasData){ SEE_MORE.loading = true; var path='${ctx}/liveClass/listMore'; $.post(path+'?size=6&pageNum='+SEE_MORE.p,function(data){ if($.trim(data)!=''){ $('#courseContainer').append(data); SEE_MORE.p++; } SEE_MORE.loading = false; },'html'); } };
<!-- 隐藏域 获取 页数, 总数/pageSize --> <input type="hidden" value="${liveClassListCount/6 }" id="pageNumberId"> <div class="container"> <ul class="live_list" id="courseContainer"> <%@include file="live_list_more.jsp"%> </ul> </div>
live_list_more.jsp 和正常jsp一样 获取后台绑定的参数就行
相关推荐
yangkang 2020-11-09
lbyd0 2020-11-17
sushuanglei 2020-11-12
85477104 2020-11-17
KANSYOUKYOU 2020-11-16
wushengyong 2020-10-28
lizhengjava 2020-11-13
星月情缘 2020-11-13
huangxiaoyun00 2020-11-13
luyong0 2020-11-08
腾讯soso团队 2020-11-06
Apsaravod 2020-11-05
PeterChangyb 2020-11-05
gaobudong 2020-11-04
wwwjun 2020-11-02
gyunwh 2020-11-02
EchoYY 2020-10-31
dingyahui 2020-10-30