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

The names of events are case-insensitive.

Detaching event listeners

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

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

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.

Back to top