A Pure Javascript Class for Paginating of DOM elements | purePajinate

PurePajinate is a pure JavaScript class for paginating across any number of DOM elements that makes it easy to create pagination controls for long block elements like cards, images, lists, etc.

Read MoreA Simple and Lightweight jQuery Pagination Plugin | jqPaginator.js

How to make use of it:

1. Load the purePajinate’s JavaScript in your HTML document.

<script src="js/purePajinate.es5.min.js"></script>

2. Insert the pagination container into your web page.

<div class="example">
  <div class="items">
    <div class="item item1">
      <div class="title">Slide 1</div>
    </div>
    <div class="item item2">
      <div class="title">Slide 2</div>
    </div>
    <div class="item item3">
      <div class="title">Slide 3</div>
    </div>
    <div class="item item4">
      <div class="title">Slide 4</div>
    </div>
    <div class="item item5">
      <div class="title">Slide 5</div>
    </div>
    <div class="item item6">
      <div class="title">Slide 6</div>
    </div>
  </div>
  <div class="page_navigation"></div>
</div>

3. Initialize the pagination library on the parent container and decide what number of objects per web page.

var myPagination = new purePajinate({
    itemsPerPage: 5
});

4. Apply your individual CSS styles to the pagination controls.

.page_navigation { 
  /* your styles here */
}

.page_navigation ul { 
  /* your styles here */
}

.page_navigation li { 
  /* your styles here */
}

.page_navigation li.active_page { 
  /* your styles here */
}

5. Navigate to the primary web page once you click on the Next button on the web page.

new purePajinate({
    wrapAround: true
});

6. Specify the variety of pagination links to show.

new purePajinate({
    pageLinksToDisplay: 5
});

7. Set the preliminary web page on the web page load.

new purePajinate({
    startPage: 1
});

8. Determine the pagination on small devices.

new purePajinate({
    hideOnSmall: true
});

9. Customize the pagination controls with the next options.

new purePajinate({
    navLabelFirst: 'First',
    navLabelPrev: 'Prev',
    navLabelNext: 'Next',
    navLabelLast: 'Last',
    navOrder: ["first", "prev", "num", "next", "last"],
    showFirstLast: false,
    showPrevNext: true
});

10. Default selectors and classes.

new purePajinate({
    containerSelector: '.items',
    itemSelector: '.item',
    navigationSelector: '.page_navigation',
    defaultClass: '',
    activeClass: "active",
    disabledClass: "disabled"
});

11. Callback capabilities.

new purePajinate({
    onInit: function onInit() { },
    onPageDisplayed: function onPageDisplayed() { }
});

Read More: Simple Pagination Plugin with Radio Input

Options

OptionTypeDescription
containerSelectorStringDefault: '.items'.
The items’ container selector.
itemSelectorStringDefault: '.item'.
The individual item’s selector.
navigationSelectorStringDefault: '.page_navigation'.
The pagination container selector.
itemsPerPageintegerDefault: 10.
The number of items that will show at once.
pageLinksToDisplayintegerDefault: 10.
The number of page links to display at once. All other pages will be hidden and replaced with …
startPageintegerDefault: 0.
The first page to show. To show page 3, the value will be 2
wrapAroundBooleanDefault: false.
Determine if the pages should loop or not.
navLabelFirstStringDefault: 'First'.
The label for the first control.
navLabelPrevStringDefault: 'Prev'.
The label for the previous control.
navLabelNextStringDefault: 'Next'.
The label for the next control.
navLabelLastStringDefault: 'Last'.
The label for the last control.
navAriaLabelFirstStringDefault: 'First'.
The aria-label for the first control.
navAriaLabelPrevStringDefault: 'Prev'.
The aria-label for the previous control.
navAriaLabelNextStringDefault: 'Next'.
The aria-label for the next control.
navAriaLabelLastStringDefault: 'Last'.
The aria-label for the last control.
navOrderArrayDefault: ["first", "prev", "num", "next", "last"].
The order of the controls. ‘num’ represents the page links.
showFirstLastBooleanDefault: false.
Determine if the first and last controls will show or not.
showPrevNextBooleanDefault: true.
Determine if the previous and next controls will show or not.
hideOnSmallBooleanDefault: false.
Determine if the pagination shows when the number of items is smaller than the number of items per page.
defaultClassStringDefault: ''.
A class to apply to all control elements.
activeClassStringDefault: 'active'.
A class to apply to the active page link.
disabledClassStringDefault: 'disabled'.
A class to apply to disabled controls.
onInitFunctionDefault: false.
Callback to be run on initialization.
onPageDisplayedFunctionDefault: false.
Callback to be run once a page is displayed.

See Demo And Download

Official Website(obuisard): Click Here

This superior jQuery/javascript plugin is developed by obuisard. For extra Advanced Usage, please go to the official website.

Related Posts

HStack-and-VStack-in-CSS

CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…

Floating-Whatsapp-Chat-Button

How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Bootstrap-4-Sidebar-Menu-Responsive-Template

Bootstrap 4 Sidebar Menu Responsive Template | MDB

Bootstrap Side Navbar – Responsive sidebar template based on the Bootstrap 4 framework. An easy-to-use, totally responsive, Google Material Design impressed aspect navigation for modern web app…

Bootstrap-4-Toast-Notification-Plugin

Lightweight Bootstrap 4 Toast Notification Plugin | BS4 Advanced Toast

A lightweight Bootstrap 4 Toast Notification plugin integrated with JS/jQuery. bs4-toast.js is a JavaScript library that enhances the native Bootstrap toast component with icons, buttons, callbacks, and…

Leave a Reply

Your email address will not be published. Required fields are marked *