Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for synchronized pagination if applying the plugin to a non-UL el…
…ement (josecebe#155)

The pagination was being applied only to the last item if the wrapper to which the pagination was being applied to were non-UL.
  • Loading branch information
Pyro979 authored and josecebe committed Jul 28, 2018
1 parent 51fb46a commit f41bb7e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions jquery.twbsPagination.js
Expand Up @@ -55,15 +55,19 @@
if (tagName === 'UL') {
this.$listContainer = this.$element;
} else {
this.$listContainer = $('<ul></ul>');
var elements = this.$element;
var $newListContainer = $([]);
elements.each(function(index) {
var $newElem = $("<ul></ul>");
$(this).append($newElem);
$newListContainer.push($newElem[0]);
});
this.$listContainer = $newListContainer;
this.$element = $newListContainer;
}

this.$listContainer.addClass(this.options.paginationClass);

if (tagName !== 'UL') {
this.$element.append(this.$listContainer);
}

if (this.options.initiateStartPageClick) {
this.show(this.options.startPage);
} else {
Expand Down

0 comments on commit f41bb7e

Please sign in to comment.