Skip to main content

Event handling

Attaching event listeners

You can attach event listeners with the pagination.events.on() method:

pagination.events.on("change", function(index, previousIndex){
console.log("The currently active page", index);
});
note

The names of events are case-insensitive.

Related sample: Pagination. Pagination events

Detaching event listeners

To detach events, use pagination.events.detach():

pagination.events.on("change", function(index, previousIndex){
console.log("The currently active page", index);
});

pagination.events.detach("change");

Calling events

To call events, use pagination.events.fire():

pagination.events.fire("name",args);
// where args is an array of arguments

The list of events

The full list of events is available in the related API section.