diff --git a/jquery.twbsPagination.js b/jquery.twbsPagination.js index ab625b8..ff76812 100644 --- a/jquery.twbsPagination.js +++ b/jquery.twbsPagination.js @@ -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); } @@ -99,6 +103,8 @@ } this.currentPage = page; + this.$element.trigger('beforePage', page); + var pages = this.getPages(page); this.render(pages); this.setupEvents(); @@ -333,6 +339,7 @@ next: 'Next', last: 'Last', loop: false, + beforePageClick: null, onPageClick: null, paginationClass: 'pagination', nextClass: 'page-item next',