滚动翻页

dev_local
cxt 6 years ago
parent 885ace98a9
commit 1d25444159

@ -25,7 +25,7 @@
</div> </div>
</div> </div>
<script> <script>
var i = 1; //设置当前页数 var ci = 1; //设置当前页数
var msg_list_loading = false; var msg_list_loading = false;
$(function() { $(function() {
$(function() { $(function() {
@ -33,7 +33,7 @@
var winH = $(window).height(); //页面可视区域高度 var winH = $(window).height(); //页面可视区域高度
$("#search_customers_list").scroll(function() { $("#search_customers_list").scroll(function() {
if (i < totalpage) { // 当滚动的页数小于总页数的时候,继续加载 if (ci < totalpage) { // 当滚动的页数小于总页数的时候,继续加载
var pageH = $(document.body).height(); var pageH = $(document.body).height();
var scrollT = $(window).scrollTop(); //滚动条top var scrollT = $(window).scrollTop(); //滚动条top
@ -41,7 +41,7 @@
console.log(aa); console.log(aa);
if ( !msg_list_loading ){ if ( !msg_list_loading ){
if (aa < 0.01 ) { if (aa < 0.01 ) {
get_schools(i+1) get_schools(ci+1)
} }
} }
} }
@ -53,7 +53,7 @@
var msg_list = $('#search_customers_list'); var msg_list = $('#search_customers_list');
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) { if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) {
msg_list_loading = true; msg_list_loading = true;
$.getJSON("<%= all_path %>?partner_id=<%= @partner.id %>page="+page+"&search="+$("#partner_name_search").val()+"&province="+$("#partner_province").val(), function(schools) { $.getJSON("<%= all_path %>?partner_id=<%= @partner.id %>&page="+page+"&search="+$("#partner_name_search").val()+"&province="+$("#partner_province").val(), function(schools) {
if (schools) { if (schools) {
msg_list_loading = false; msg_list_loading = false;
var s_html = ""; var s_html = "";
@ -62,14 +62,14 @@
" <span class='fl with70'>" + " <span class='fl with70'>" +
" <span>" + " <span>" +
" <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_"+array["school"]["id"]+"' class='magic-checkbox'>" + " <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_"+array["school"]["id"]+"' class='magic-checkbox'>" +
" <label for='school_'"+array["school"]["id"]+">"+array["school"]["name"]+"</label>" + " <label for='school_"+array["school"]["id"]+"'>"+array["school"]["name"]+"</label>" +
" </span>\n" + " </span>\n" +
" </span>\n" + " </span>\n" +
" <span class='fl with30'>"+array["school"]["province"]+"</span>" + " <span class='fl with30'>"+array["school"]["province"]+"</span>" +
" </p>" " </p>"
}); });
$("#search_customers_list").append(s_html); $("#search_customers_list").append(s_html);
i ++; ci ++;
} }
}); });
} }

@ -61,7 +61,7 @@
s_html = s_html+ "<p class='clearfix'>" + s_html = s_html+ "<p class='clearfix'>" +
" <span class='fl edu-txt-w90'>" + " <span class='fl edu-txt-w90'>" +
" <input type='checkbox' name='partner_member[]' value='"+array["id"]+"' id='user_"+array["id"]+"' class='magic-checkbox'>" + " <input type='checkbox' name='partner_member[]' value='"+array["id"]+"' id='user_"+array["id"]+"' class='magic-checkbox'>" +
" <label for='user_'"+array["id"]+">"+array["real_name"]+"</label>" + " <label for='user_"+array["id"]+"'>"+array["real_name"]+"</label>" +
" </span>\n" + " </span>\n" +
"<span class='fl edu-txt-w90 mt5 edu-txt-center color-grey-6 pointer'>"+array["identity"]+"</span>" + "<span class='fl edu-txt-w90 mt5 edu-txt-center color-grey-6 pointer'>"+array["identity"]+"</span>" +
"<span class=\"fl task-hide edu-txt-w200 mt5 edu-txt-left color-grey-9\">"+array["school_name"]+"</span>" + "<span class=\"fl task-hide edu-txt-w200 mt5 edu-txt-left color-grey-9\">"+array["school_name"]+"</span>" +

@ -60,7 +60,7 @@
" <span class='fl with70'>" + " <span class='fl with70'>" +
" <span>" + " <span>" +
" <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_"+array["school"]["id"]+"' class='magic-checkbox'>" + " <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_"+array["school"]["id"]+"' class='magic-checkbox'>" +
" <label for='school_'"+array["school"]["id"]+">"+array["school"]["name"]+"</label>" + " <label for='school_"+array["school"]["id"]+"'>"+array["school"]["name"]+"</label>" +
" </span>\n" + " </span>\n" +
" </span>\n" + " </span>\n" +
" <span class='fl with30'>"+array["school"]["province"]+"</span>" + " <span class='fl with30'>"+array["school"]["province"]+"</span>" +

Loading…
Cancel
Save