Skip to main content

onSlide

onSlide method allows you to subscribe to the slide event


Example

const blazeSlider = new BlazeSlider(el, options?)

// subscribe to the slide event
const unsubscribe = blazeSlider.onSlide(
(pageIndex, firstVisibleSlideIndex, lastVisibleSlideIndex) => {

// index of the current page ( pagination index )
console.log(pageIndex);

// first and last visible slide index
console.log(firstVisibleSlideIndex, lastVisibleSlideIndex);
});

// when you want to unsubscribe - call the returned `unsubscribe` function

Open in Playground