/superlooper

Provide infinite loop pagination for Arrays

Primary LanguageJavaScriptMIT LicenseMIT

superlooper

Superlooper is not a carousel... is not a slider... it is not a paging plug-in. Superlooper simply is a class for paging data from an Array, the implementation is up to you.

Use

// Some fake data
const fakeData = [0, 1, 2, 3, 4 ... ]

/**
* Create Superlooper object
* @param {Array} data to paginate
* @param {Number} items to show per page
**/
const superlooper = new Superlooper(fakeData, 6)


/**
 * API methods
 */

// Initialize. Returns index 0
superlooper.initialize()

// Next
superlooper.next()

// Previous
superlooper.prev()

// Go to especific index (normalized!)
superlooper.goTo(6)

Example

You can see in action here.