Search.../

onChange( )

Adds an event handler that runs when the slideshow moves to a new slide.

Description

A slideshow moves to a new slide through user actions, such as clicking on navigation or slide buttons, or programmatically, using functions such as changeSlide(), play(), previous( ), and next( ).

Note: You can see the Slideshow element in the Velo Properties & Events panel, but its Slide elements are not visible there.

Syntax

function onChange(eventHandler: EventHandler): Slideshow
eventHandler: function EventHandler(event: Event): void

onChange Parameters

NAME
TYPE
DESCRIPTION
eventHandler

The name of the function or the function expression to run when the slideshow moves to a new slide.

Returns

The slideshow on which the event is now registered.

Return Type:

EventHandler Parameters

NAME
TYPE
DESCRIPTION
event

The event that occurred.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Get the index of the slide to which the slideshow moved

Copy Code
1$w("#mySlideshow").onChange( (event) => {
2 let currentIndex = event.target.currentIndex; // 3
3} );