swiper.enable() method does not work #7266
Unanswered
heretoshleigh
asked this question in
Q&A
Replies: 1 comment 1 reply
-
@nolimits4web I'm wondering if there is a bug with the enable() method? I console logged the swiper instance at the bottom of my function, and it shows that when the swiper is disabled and a user clicks the pause/play button, the swiper enabled property value correctly changes to true, yet the swiper does not restart. However, I was able to find a solution. It seems that the correct syntax for pausing/resuming and starting/stopping autoplay is actually swiper.autoplay.start(), not swiper.start() as the documentation states. I came across this on Stack Overflow. Seems like the documentation needs to be updated. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey all - I'm hoping someone can help me. I have a hero with two synced swipers in it. They are vertical swipers in autoplay and loop mode. For accessibility purposes, I'm trying to add a simple pause/play button using the native swiper.disable() and swiper.enable() methods.
The swiper.disable() method works correctly on button click, but swiper.enable() does nothing. There are no console errors. I have done my best to debug, but the event listeners are firing correctly, the conditionals are triggering correctly, the swiper objects and their state are as you would expect... What am I missing?
I also tried using the autoplay methods swiper.pause/swiper.resume and swiper.stop/swiper.start, which would seem to be even more appropriate, but those throw console errors (Type Error - heroGraphicSwiper.pause is not a function, etc.).
Here's my event listener. I have two buttons due to their locations on mobile vs. desktop. I can share other code if it's helpful.
Beta Was this translation helpful? Give feedback.
All reactions