From 206f35d6a93ec17ae8fa3df93b5063cb95c97c73 Mon Sep 17 00:00:00 2001 From: Edmundo Elizondo Date: Fri, 2 Mar 2018 10:22:20 -0600 Subject: [PATCH] Add support for multiple-element jQuery container at init --- src/pagination.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pagination.js b/src/pagination.js index 4a68b70..c367200 100644 --- a/src/pagination.js +++ b/src/pagination.js @@ -82,10 +82,20 @@ var el = self.render(true); // Add extra className to the pagination element - if (attributes.className) { + if (attributes.className) { el.addClass(attributes.className); } + // Append/prepend pagination element to the container + var elClones = []; + container.each(function(index, element) { + var elClone = el.clone(true); + $(element)[attributes.position === 'bottom' ? 'append' : 'prepend'](elClone); + elClones.push(elClone); + }) + + // Convert the clones array of elements into a jQuery set. Update "el" to this new set of "els". + el = $(elClones).map(function () { return this.toArray(); }); model.el = el; // Append/prepend pagination element to the container