From 05073a061fdd5f387f0f686582f818635c6ea51b Mon Sep 17 00:00:00 2001 From: XunQilong <963877037@qq.com> Date: Wed, 6 Apr 2016 18:05:54 +0800 Subject: [PATCH 1/5] fix maxVisble=1 bug --- lib/jquery.bootpag.js | 7 ++----- lib/jquery.bootpag.min.js | 36 ++++++++++++++++-------------------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/lib/jquery.bootpag.js b/lib/jquery.bootpag.js index d5d101f..85576d2 100644 --- a/lib/jquery.bootpag.js +++ b/lib/jquery.bootpag.js @@ -55,7 +55,6 @@ page = parseInt(page, 10); var lp, maxV = settings.maxVisible == 0 ? 1 : settings.maxVisible, - step = settings.maxVisible == 1 ? 0 : 1, vis = Math.floor((page - 1) / maxV) * maxV, $page = $bootpag.find('li'); settings.page = page = page < 0 ? 0 : page > settings.total ? settings.total : page; @@ -80,11 +79,9 @@ .attr('data-lp', lp) .find('a').attr('href', href(lp)); - var step = settings.maxVisible == 1 ? 0 : 1; - lp = page + 1 > settings.total ? settings.total : - settings.leaps && page + 1 < settings.total - settings.maxVisible ? - vis + settings.maxVisible + step: page + 1; + settings.leaps && vis < settings.total - settings.maxVisible ? + vis + settings.maxVisible + 1: page + 1; var llast = $page.last(); if(settings.firstLastUse) { diff --git a/lib/jquery.bootpag.min.js b/lib/jquery.bootpag.min.js index 324b1a3..91a4af9 100644 --- a/lib/jquery.bootpag.min.js +++ b/lib/jquery.bootpag.min.js @@ -1,21 +1,17 @@ -/* +/** + * @preserve + * bootpag - jQuery plugin for dynamic pagination + * + * Copyright (c) 2015 botmonster@7items.com + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/mit-license.php + * + * Project home: + * http://botmonster.com/jquery-bootpag/ + * + * Version: 1.0.7 + * + */ - bootpag - jQuery plugin for dynamic pagination - - Copyright (c) 2015 botmonster@7items.com - - Licensed under the MIT license: - http://www.opensource.org/licenses/mit-license.php - - Project home: - http://botmonster.com/jquery-bootpag/ - - Version: 1.0.7 - -*/ -(function(h,q){h.fn.bootpag=function(p){function m(c,b){b=parseInt(b,10);var d,e=0==a.maxVisible?1:a.maxVisible,k=1==a.maxVisible?0:1,n=Math.floor((b-1)/e)*e,f=c.find("li");a.page=b=0>b?0:b>a.total?a.total:b;f.removeClass(a.activeClass);d=1>b-1?1:a.leaps&&b-1>=a.maxVisible?Math.floor((b-1)/e)*e:b-1;a.firstLastUse&&f.first().toggleClass(a.disabledClass,1===b);e=f.first();a.firstLastUse&&(e=e.next());e.toggleClass(a.disabledClass,1===b).attr("data-lp",d).find("a").attr("href",g(d));k=1==a.maxVisible? -0:1;d=b+1>a.total?a.total:a.leaps&&b+1