使用示意
修改下面的一些数值,预览分页效果:
总数据量:
每页数目:15
30
new Pagination($('#testPage'), {
length: elPageLength.val() * 1,
every: elPageEvery.val() * 1
});
new Pagination($('#testPage2'), {
length: elPageLength.val() * 1,
every: elPageEvery.val() * 1
mode: 'short'
});
动态href地址的分页
var currentPageId = 1;
if (/pageid/.test(location.href)) {
$(window).scrollTop($('#testPage').offset().top);
currentPageId = location.href.split('pageid=')[1].split(/\D/g)[0];
}
new Pagination($('#testPage3'), {
length: 400,
current: currentPageId,
href: function(current) {
return '?pageid=' + current;
}
});