From f41bb7edab9d5263c250b7e1bf27036739aa83ca Mon Sep 17 00:00:00 2001 From: Pyro979 Date: Sat, 28 Jul 2018 09:09:16 -0400 Subject: [PATCH] Fix for synchronized pagination if applying the plugin to a non-UL element (#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. --- jquery.twbsPagination.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/jquery.twbsPagination.js b/jquery.twbsPagination.js index 4b529be..5632e66 100644 --- a/jquery.twbsPagination.js +++ b/jquery.twbsPagination.js @@ -55,15 +55,19 @@ if (tagName === 'UL') { this.$listContainer = this.$element; } else { - this.$listContainer = $(''); + var elements = this.$element; + var $newListContainer = $([]); + elements.each(function(index) { + var $newElem = $(""); + $(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 {