I have a swiper which is autoplay and when i hover over it it should stop immediately, now it finishes the transition and only after that it stops
Here is the question how can I stop it immediately at the place where the cursor was hovered, without waiting for the end of the transition
Can I somehow interrupt the transition maibe
Here is Swiper config on Vue
this.swiper = new Swiper('.swiper-brand-container', {
loop: true,
spaceBetween: 120,
slidesPerView: 'auto',
centeredSlides: true,
nested: true,
speed: 5000,
autoplay: {
delay: 0,
},
});
and functions for stop and start autoplay
stopAutoplay() {
if (this.swiper) {
this.swiper.autoplay.stop();
}
},
startAutoplay() {
if (this.swiper) {
this.swiper.autoplay?.start();
}
},
- I tried to recreate the swiper without autoplay
- tried to influence the swiper container through styles
- Change parameters dynamically
couldn’t find any information
2
Answers
Since I didn't find any answer, and no one gave any advice, I had to somehow get out of my way and I didn't think of anything better than to do this scrolling myself
I just add an interval, and every half a second I move the block by a couple of pixels, and if I need to stop scrolling, I remove the interval
it's not perfect, so if you have ideas on how to improve, please write
Try this
Or this