1.2.0 • Published 8 years ago

basic-pagination v1.2.0

Weekly downloads
5
License
ISC
Repository
github
Last release
8 years ago

Pagination: Nothin' fancy

A simple, self-contained, modular controller for managing paginated links. Perfect complement to any AJAX-powered component that displays results in sets.

# Quick install with package managers:
bower install basic-pagination
npm install basic-pagination

Usage

let pager = new Pagination(el, {
	
	/** Zero-based index of initially-selected link */
	active: 2,
	
	/** Callback triggered when a link is pressed by user */
	onChange: function(newIndex, oldIndex){
		console.log(`Current page is now ${newIndex}`);
	},
	
	linkTemplate: '<li><a href="#">Custom element, you say?</a></li>'
});

/** Programmatically set selected link */
pager.active = 10;

Full option documentation can be found here.

License

Oh, I am so not fussed. This is released under the ISC license, which is basically just a simplified version of the MIT license.

Author attribution is nice, but I won't sledge your car door in for not putting my name in your work. Really. Credit me, thank me, send me a fruit basket, set my face as your desktop (I recommend this) ... all are nice, but none are mandatory.