You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@jemmyphan/js-pagination

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jemmyphan/js-pagination

pagination implemented in pure JavaScript

0.1.2
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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()

Keywords

pagination

FAQs

Package last updated on 13 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.