My swiper is set to autoplay, but I want it to stop immediately when hovered over instead of waiting for the transition to finish.
Is there a way to interrupt the transition and stop it at the exact point where the cursor hovers?
Here is my Swiper configuration in Vue:
this.swiper = new Swiper('.swiper-brand-container', {
loop: true,
spaceBetween: 120,
slidesPerView: 'auto',
centeredSlides: true,
nested: true,
speed: 5000,
autoplay: {
delay: 0,
},
});
Below are the functions for stopping and starting the autoplay:
stopAutoplay() {
if (this.swiper) {
this.swiper.autoplay.stop();
}
},
startAutoplay() {
if (this.swiper) {
this.swiper.autoplay?.start();
}
},
- I attempted to recreate the swiper without autoplay
- Tried manipulating the swiper container through styles
- Dynamically changing parameters
Despite my efforts, I couldn't find a solution to stop the transition immediately upon hover.