dynamic pagination links - Free Download Dynamically Generate Pagination Links With jQuery Pagination.js

Free Download Dynamically Generate Pagination Links With jQuery Pagination.js

Posted on

This time I will share jQuery Plugin and tutorial about Dynamically Generate Pagination Links With jQuery Pagination.js, hope it will help you in programming stack.

dynamic pagination links - Free Download Dynamically Generate Pagination Links With jQuery Pagination.js
File Size: 4.81 KB
Views Total: 4555
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A small (~1kb) and customizable jQuery plugin that allows developers to dynamically generate pagination links for long content & larger lists.

How to use it:

1. By default the plugin uses Bootstrap 4’s stylesheet to style the pagination links. Without the need of Bootstrap JS.

1 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

2. Load the Pagination.js script after jQuery but before the closing body tag.

1 <script src="jquery.min.js"></script>
2 <script src="pagination.js"></script>

3. Create an empty unordered list in which the plugin will generate the pagination links.

1 <div id="page">
2   <ul class="pagination"></ul>
3 </div>

4. Call the function on the top container and specify the number of items to paginate.

1 $(function() {
2   $('#page').Pagination({
3     size: 100
4   });
5 });

5. Specify the number of pages to generate. Default: 5.

1 $(function() {
2   $('#page').Pagination({
3     size: 100,
4     pageShow: 3
5   });
6 });

6. Set the initial page. Default: page 1.

1 $(function() {
2   $('#page').Pagination({
3     size: 100,
4     page: 2
5   });
6 });

7. Limit the number of items to display per page. Default: 1.

1 $(function() {
2   $('#page').Pagination({
3     size: 100,
4     limit: 10
5   });
6 });

8. Return the current page using the callback function:

1 $(function() {
2   $('#page').Pagination({
3     size: 100,
4     limit: 10
5   },function(obj){
6     alert(obj.page);
7   });
8 });

9. Determine whether to display the first/last labels. Default: false.

1 $(function() {
2   $('#page').Pagination({
3     boundary: true
4   });
5 });

10. You can also apply custom styles to the pagination links without Bootstrap 4.

1 .pagination {
2   /* ... */
3 }
4  
5 .page-item {
6   /* ... */
7 }

Changelog:

2019-05-02

  • Added update new Boundary option

This awesome jQuery plugin is developed by jounger. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net