jp

js-pagination

Pagination implemented in pure JavaScript

Showing:

Popularity

Downloads/wk

4

GitHub Stars

8

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

0

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

js-pagination

pagination implemented in pure JavaScript

Install & run example

// install
npm i -S 'js-pagination'

// run example
git clone https://github.com/rainjay/pagination.git
cd pagination
npm install
npm run dev

Example demo

DEMO

Usage

require('js-pagination/dist/styles.css')
var Pagination = require('js-pagination')

// config
Pagination.config({
  ulClass: 'pagination',
  activeClass: 'active',
  ...
})

// use
var myPager = new Pagination(100, 15, function(page) {}, '.field')

myPager.getCurrentPage()
myPager.goToPage(num)

// html
<div class="field"></div>

API

config attributes (optional)

keyTypeDetails
ulClassStringclass name for page lists, default 'pagination'
activeClassStringclass name for active page item, default 'active'
disableClassStringdisable class name for disabled item, default 'disabled'
dotsStringdefault '...'
hideIfEmptyBooleanwhether to hide paging if only have one page, default true
showPreNextBolleanwhether show pre and next button, default true
scrollTopBolleanwhether scroll to top after you select one page, default false
scrollContainerStringwhich container to scroll
adjacentNumberthe page amount before and after the current page, default 2
lang'cn' or 'en'default 'cn'

var pager = new Pagination(total, size, callback, fieldSelector)

keyTypeDetails
totalNumberthe total size of what you are displaying
sizeNumbersize of each page, default 1
sizeNumbersize of each page, default 1
callbackFunctioncall back for page select operation
fieldSelectorStringthe field u want to mount, exp: '.field'

pager.goToPage(num)

keyTypeDetails
numNumberthe page num will go to

pager.getCurrentPage()

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial