$(document).ready(function () { ? ? ? ?$.jqPaginator('#pag-cove', { ? ? ? ?totalCounts: 9, ? ? ? ? ?// 總條數 ? ? 怎樣動態獲取這個 ? ? ? ?visiblePages: 3, ? ? ? ? ?//最多顯示頁碼 ? ? ? ?pageSize: 3, ? ? ? ? ? ? //每頁條數 ? ? ? ?currentPage: 1, ? ? ? ? //當前頁碼 ? ? ? ?first: '<li class="first"><a href="javascript:;">首頁</a></li>', ? ? ? ?prev: '<li class="prev"><a href="javascript:;">上一頁</a></li>', ? ? ? ?page: '<li class="page"><a href="javascript:;">{{page}}</a></li>', ? ? ? ?next: '<li class="next"><a href="javascript:;">下一頁</a></li>', ? ? ? ?last: '<li class="last"><a href="javascript:;">共{{totalPages}}頁</a></li>', ? ? ? ?onPageChange: function (num, type) { ? ? ? ? ? ?pagination(num); ? ? ? ? ? ?// 媒體報道列表 ? ? ? ? ? ?function pagination(currentPage) { ? ? ? ? ? ? ? ?var data = { ? ? ? ? ? ? ? ? ? ?"parameters": "{\"pageSize\":\"3\",\"currentPage\":" + currentPage + "}" ? ? ? ? ? ? ? ?}; ? ? ? ? ? ? ? ?$.ajax({ ? ? ? ? ? ? ? ? ? ?type: "POST", ? ? ? ? ? ? ? ? ? ?dataType: "jsonp", ? ? ? ? ? ? ? ? ? ?jsonp: "callback", ? ? ? ? ? ? ? ? ? ?jsonpCallback: "jsonpCallback", ? ? ? ? ? ? ? ? ? ?url: adressurl.one.uri + "web/mtggList/open.do", ? ? ? ? ? ? ? ? ? ?data: data, ? ? ? ? ? ? ? ? ? ?success: function (data) { ? ? ? ? ? ? ? ? ? ? ? ?var appendHtml = "" ? ? ? ? ? ? ? ? ? ? ? ?var noticeList = data.noticeList ? data.noticeList : []; ? ? ? ? ? ? ? ? ? ? ? ?// var noticeCount = data.noticeCount ? data.noticeCount : []; ? ? ? ? ? ? ? ? ? ? ? ?for (var c = 0; c < noticeList.length; c++) { ? ? ? ? ? ? ? ? ? ? ? ? ? ?console.log(noticeList); ? ? ? ? ? ? ? ? ? ? ? ? ? ?console.log('總條數:' + noticeList.length); ? ? ? ? ? ? ? ? ? ? ? ? ? ?var medanewid = ''; ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (!!noticeList[c] && !!noticeList[c].id) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?medanewid = noticeList[c].id; ? ? ? ? ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ?console.log("id:",medanewid); ? ? ? ? ? ? ? ? ? ? ? ? ? ?var title = ''; ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (!!noticeList[c] && !!noticeList[c].title) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?title = noticeList[c].title; ? ? ? ? ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ?var content = ''; ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (!!noticeList[c] && !!noticeList[c].content) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?content = noticeList[c].content; ? ? ? ? ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ?var insertTime = ''; ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (!!noticeList[c] && !!noticeList[c].insertTime) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?insertTime = noticeList[c].insertTime; ? ? ? ? ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ?var dateType = ""; ? ? ? ? ? ? ? ? ? ? ? ? ? ?var date = new Date(); ? ? ? ? ? ? ? ? ? ? ? ? ? ?date.setTime(insertTime); ? ? ? ? ? ? ? ? ? ? ? ? ? ?dateType = date.getFullYear() + "-" + getMonth(date) + "-" + getDay(date);//yyyy-MM-dd格式日期 ? ? ? ? ? ? ? ? ? ? ? ? ? ?var mediatitleUrl = ''; ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (!!noticeList[c] && !!noticeList[c].titleUrl) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?mediatitleUrl = noticeList[c].titleUrl; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?var mediatitleUrljq = mediatitleUrl.substring(0, mediatitleUrl.length - 1); ? ? ? ? ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ?appendHtml = appendHtml + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'<li class="row cove-bot"><a target="_blank" href="details.html?id=' + medanewid + '">' + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'<div class="col-md-3">' + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'<img src="http://' + mediatitleUrljq + '">' + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'</div>' + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'<div class="col-md-9">' + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'<h4>' + title + '<small>' + dateType + '</small></h4>' + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'<h5>' + content + '</h5>' + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'</div>' + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'</li>' ? ? ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ? ? ?$(".cove-cent-u").html(appendHtml); ? ? ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ?}); ? ? ? ? ? ? ? ?return ?(num); ? ? ? ? ? ?} ? ? ? ?} ? ?});});
請問誰用過jqPaginator分頁插件呢,該怎樣動態設置總條數?
鯨與海
2017-09-07 09:31:50