var SEE_MORE={p:1,loading:false,hasData:true}; //Pull down to the end js to judge $(window).scroll(function () { loadData(); }); function loadData() { totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop()); if ($(document).height() <= totalheight +300) { // run when loaded loadmore(); } } <%//Load more%> 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'); } };
<!-- Hidden field to get the number of pages, total/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 is the same as normal jsp, just get the parameters bound in the background