前臺ios
mui.init(); (function($) { //阻尼係數 var deceleration = mui.os.ios?0.003:0.0009; $('.mui-scroll-wrapper').scroll({ bounce: false, indicators: true, //是否顯示滾動條 deceleration:deceleration }); $.ready(function() { //循環初始化全部下拉刷新,上拉加載。 $.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) { if(index==0){ // alert(index); $(pullRefreshEl).pullToRefresh({ down: { callback:pulldownRefresh_zhengu }, up: { callback: pullupRefresh_zhengu } }); }else{ // alert(index); $(pullRefreshEl).pullToRefresh({ container:"#item2mobile .mui-scroll", down: { callback: pulldownRefresh_guandian }, up: { callback: pullupRefresh_guandian } }); } }); bbb(1); aaa(1); var page = 1; var sum; var page1 = 1; var su; /*診股開始*/ function pulldownRefresh_zhengu(){ var self = this; page++; setTimeout(function() { bbb(page); self.endPullDownToRefresh((sum <= page)); }, 1000); } function pullupRefresh_zhengu(){ var self = this; page++; setTimeout(function() { bbb(page); self.endPullUpToRefresh((sum <= page)); }, 1000); } /*診股結束*/ /**觀點開始**/ function pulldownRefresh_guandian(){ var self = this; page1++; setTimeout(function() { aaa(page1) self.endPullDownToRefresh(); }, 1000); } function pullupRefresh_guandian(){ var self = this; page1++; setTimeout(function() { aaa(page1); self.endPullUpToRefresh(); }, 1000); } /**觀點結束**/ }); })(mui);
而後寫ajax請求,帶入分頁page。ajax
後臺對傳過來的page參數進行處理:app
$page = I('page'); //獲取請求的頁數 $pagenum = 15; //每頁數量 $start = ($page-1) * $pagenum; //查詢數據 limit($page,$pagenum)