onCurrentItemChanged( )


Adds an event handler that runs when a gallery's current item changes.

A gallery's current item changes through playing or certain user interactions.

Notes:

  • The onCurrentItemChanged() function is supported by galleries where the hasCurrentItem capability is true.

  • If you change the gallery's type to one that doesn't support hasCurrentItem and you try to use it, your code may no longer function correctly.

Method Declaration
Copy
Method Parameters
handlerfunctionRequired

handler(event: GalleryItemChangedEvent): void The name of the function or the function expression to run when the gallery's current item changes.

Returns
Return Type:Gallery
Did this help?