Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix bug: total pages less than visible
  • Loading branch information
Eugene Simakin committed Jan 14, 2014
1 parent 5bee5ca commit 698c6a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions jquery.twbsPagination.js
Expand Up @@ -28,8 +28,6 @@
init: function (options) {
this.options = $.extend({}, this.options, options);

this.currentPages = this.getPages(this.options.startPage);

if (this.options.startPage < 1 || this.options.startPage > this.options.totalPages) {
throw new Error('Start page option is incorrect');
}
Expand All @@ -38,10 +36,12 @@
throw new Error('Total pages option cannot be less 1 (one)!');
}

if (!$.isNumeric(this.options.visiblePages) && !this.options.visiblePages) {
if (this.options.totalPages < this.options.visiblePages) {
this.options.visiblePages = this.options.totalPages;
}

this.currentPages = this.getPages(this.options.startPage);

if (this.options.onPageClick instanceof Function) {
this.$element.bind('page', this.options.onPageClick);
}
Expand Down
2 changes: 1 addition & 1 deletion jquery.twbsPagination.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 698c6a2

Please sign in to comment.