From d164b45af59c71bdfd753dbcc5ff2bf6fbc8360a Mon Sep 17 00:00:00 2001 From: Tuan Duong Date: Sun, 15 Oct 2017 14:42:32 +0700 Subject: [PATCH] - Add support for "ul" in pagination navigation - Add support for extra class in pagination navigation 2 new configs are added: - navElement: 'ul' (ul > li > a) or 'div' (div > a) - navElementClass: extra classes --- lib/jquery.easyPaginate.js | 63 ++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/lib/jquery.easyPaginate.js b/lib/jquery.easyPaginate.js index 9f959de..a6ad691 100644 --- a/lib/jquery.easyPaginate.js +++ b/lib/jquery.easyPaginate.js @@ -36,7 +36,9 @@ $.fn.easyPaginate = function (options) { prevButton: true, prevButtonText: '<', nextButton: true, - nextButtonText: '>' + nextButtonText: '>', + navElement: 'div', // 'ul' for ul > li > a, 'div' for div > a + navElementClass: '', } return this.each (function (instance) { @@ -56,29 +58,70 @@ $.fn.easyPaginate = function (options) { }; var displayNav = function() { - htmlNav = '
'; - - if(plugin.settings.firstButton) { + var navElementClass = plugin.settings.navElementClass === '' + ? 'easyPaginateNav' + : 'easyPaginateNav ' + plugin.settings.navElementClass; + if (plugin.settings.navElement === 'ul') { + htmlNav = ''; + } else { + htmlNav += '
'; } - - htmlNav += ''; plugin.nav = $(htmlNav); plugin.nav.css({ 'width': plugin.el.width()