Pagination

Pagination will render pagination with bootstrap classes. The el must be a ul.

Example Usage

<ul class="pagination-test"></ul>
// Pull in the library
const UI = require('jibe-juice');

// Instantiate a component, pass the selector of the container to insert component into and the opts
const pagination = new UI.Pagination('.pagination-test', {
  cssStyle: 'pagination',
  edges: 0,
  hrefTextPrefix: '#?page=',
  itemsOnPage: 10,
  nextText: '<span class="icon icon-arrow_forward icon-arrow"></span>',
  onPageClick(pageNumber, event) {
    alert('Page number: ' + pageNumber);
  },
  prevText: '<span class="icon icon-arrow_back icon-arrow"></span>'
});

// Render the DOM for the Pagination component
pagination.render();

params

NameTypeDefaultDescription
elstringundefinedA string of the selector for the element to put the component in
optsobject{}A catch all for various options. See the opts table below for options specific to this component.

opts

NameTypeDefaultDescription
currentPagenumber1The page we are currently on
edgesnumber0How many page numbers are visible at the beginning and ending of pagination
hrefTextPrefixstring'#page-'A string to prefix to the front of all hrefs
itemsnumber100The total number of items in the list
itemsOnPagenumber10The number of items to display per page
nextTextstring'Next'The text to display in the next button
onPageClickfunctionundefinedA function to call when the page is changed
prevTextstring'Prev'The text to display in the previous button