Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
josecebe#148 Create 'beforePageClick' method
  • Loading branch information
josecebe committed Jul 29, 2018
1 parent 6b9625e commit fb94441
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions jquery.twbsPagination.js
Expand Up @@ -32,6 +32,10 @@
throw new Error('Visible pages option is not correct!');
}

if (this.options.beforePageClick instanceof Function) {
this.$element.first().on('beforePage', this.options.beforePageClick);
}

if (this.options.onPageClick instanceof Function) {
this.$element.first().on('page', this.options.onPageClick);
}
Expand Down Expand Up @@ -99,6 +103,8 @@
}
this.currentPage = page;

this.$element.trigger('beforePage', page);

var pages = this.getPages(page);
this.render(pages);
this.setupEvents();
Expand Down Expand Up @@ -333,6 +339,7 @@
next: 'Next',
last: 'Last',
loop: false,
beforePageClick: null,
onPageClick: null,
paginationClass: 'pagination',
nextClass: 'page-item next',
Expand Down

0 comments on commit fb94441

Please sign in to comment.