diff --git a/js/jquery.twbsPagination.js b/js/jquery.twbsPagination.js index 15bb5ee..332c01c 100644 --- a/js/jquery.twbsPagination.js +++ b/js/jquery.twbsPagination.js @@ -1,5 +1,5 @@ /*! - * jQuery pagination plugin v1.4 + * jQuery pagination plugin v1.4.1 * http://esimakin.github.io/twbs-pagination/ * * Copyright 2014-2016, Eugene Simakin @@ -32,8 +32,13 @@ throw new Error('Visible pages option is not correct!'); } + if (this.options.onPageClick instanceof Function) { + this.$element.first().on('page', this.options.onPageClick); + } + // hide if only one page exists - if (this.options.totalPages == 1) { + if (this.options.hideOnlyOnePage && this.options.totalPages == 1) { + this.$element.trigger('page', 1); return this; } @@ -41,10 +46,6 @@ this.options.visiblePages = this.options.totalPages; } - if (this.options.onPageClick instanceof Function) { - this.$element.first().on('page', this.options.onPageClick); - } - if (this.options.href) { this.options.startPage = this.getPageFromQueryString(); if (!this.options.startPage) { @@ -282,6 +283,7 @@ startPage: 1, visiblePages: 5, initiateStartPageClick: true, + hideOnlyOnePage: false, href: false, pageVariable: '{{page}}', totalPagesVariable: '{{total_pages}}', @@ -310,6 +312,6 @@ return this; }; - $.fn.twbsPagination.version = "1.4"; + $.fn.twbsPagination.version = "1.4.1"; })(window.jQuery, window, document);