Skip to main content

Event handling

Attaching event listeners

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

slider.events.on("change", function(newValue, oldValue, isRange){
console.log("The value of a slider has changed to "+slider.getValue());
});
note

The names of events are case-insensitive.

Related sample: Slider. Events

Detaching event listeners

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

slider.events.on("change", function(newValue, oldValue, isRange) {
console.log("The value of a slider has changed to "+slider.getValue());
});

slider.events.detach("change");

Calling events

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

slider.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.