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 More: A 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
Option | Type | Description |
---|---|---|
containerSelector | String | Default: '.items' .The items’ container selector. |
itemSelector | String | Default: '.item' .The individual item’s selector. |
navigationSelector | String | Default: '.page_navigation' .The pagination container selector. |
itemsPerPage | integer | Default: 10 .The number of items that will show at once. |
pageLinksToDisplay | integer | Default: 10 .The number of page links to display at once. All other pages will be hidden and replaced with … |
startPage | integer | Default: 0 .The first page to show. To show page 3, the value will be 2 |
wrapAround | Boolean | Default: false .Determine if the pages should loop or not. |
navLabelFirst | String | Default: 'First' .The label for the first control. |
navLabelPrev | String | Default: 'Prev' .The label for the previous control. |
navLabelNext | String | Default: 'Next' .The label for the next control. |
navLabelLast | String | Default: 'Last' .The label for the last control. |
navAriaLabelFirst | String | Default: 'First' .The aria-label for the first control. |
navAriaLabelPrev | String | Default: 'Prev' .The aria-label for the previous control. |
navAriaLabelNext | String | Default: 'Next' .The aria-label for the next control. |
navAriaLabelLast | String | Default: 'Last' .The aria-label for the last control. |
navOrder | Array | Default: ["first", "prev", "num", "next", "last"] .The order of the controls. ‘num’ represents the page links. |
showFirstLast | Boolean | Default: false .Determine if the first and last controls will show or not. |
showPrevNext | Boolean | Default: true .Determine if the previous and next controls will show or not. |
hideOnSmall | Boolean | Default: false .Determine if the pagination shows when the number of items is smaller than the number of items per page. |
defaultClass | String | Default: '' .A class to apply to all control elements. |
activeClass | String | Default: 'active' .A class to apply to the active page link. |
disabledClass | String | Default: 'disabled' .A class to apply to disabled controls. |
onInit | Function | Default: false. Callback to be run on initialization. |
onPageDisplayed | Function | Default: 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.