unable to pause bootstrap5 carousel #35673
Replies: 14 comments 6 replies
-
The option If you don't want the carousel to cycle automatically, you need to use the option https://getbootstrap.com/docs/5.1/components/carousel/#options |
Beta Was this translation helpful? Give feedback.
-
Yh, I have tried that, but with no luck.
...and the method stated in the bootstrap documentation:
and
but nothing so far has worked.... |
Beta Was this translation helpful? Give feedback.
-
I finally got it working with the following from w3schools info - https://www.w3schools.com/bootstrap/bootstrap_ref_js_carousel.asp
not sure why it didn't work previously. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
These work fine in the console, but when I try and run them within the document.ready of an external script, I get no luck at all.
The webworker stuff works fine, but getting the stupid carousel to pause until the next image has loaded is proving to be a pain in the a**. I guess I am probably having problems with event delegation or similar. GAH! |
Beta Was this translation helpful? Give feedback.
-
Apparently pausing the carousel doesn't work inside a slide event handler. It works fine in the slid event handler, but I need to test the availability of an img before the slide works. BOOH carousel designer... |
Beta Was this translation helpful? Give feedback.
-
but but it works in the console... |
Beta Was this translation helpful? Give feedback.
-
However, the following works in the body of the document.ready:
and $('#carousel_id').carousel('pause') works in the slid event (but not the slide event). |
Beta Was this translation helpful? Give feedback.
-
So, I am really pissed off with this. I can't seem to find a way to pause the carousel inside the slid or slide eventlistener. I don't know why it doesn't work. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Once I added |
Beta Was this translation helpful? Give feedback.
-
All mentioned here did not work in BS 5.3 :-( |
Beta Was this translation helpful? Give feedback.
-
Bootstrap v5.3.2: Timeout like 1000 worked for me and nothing else:
So, with this investigation, I think Bootstrap is not able to pause the carousel as it's in cycling state when button is clicked and it's taking some time to take effect. Timeout with 600 doesn't work but timeout delay with 601 worked fine too. As I noticed the following css from bootstrap:
To conclude, this workaround solution with 1000 delay time is also not bad because next cycle occurs at 1200, and you will see the carousel in paused state. |
Beta Was this translation helpful? Give feedback.
-
Hi, I am trying to pause a bootstrap 5 carousel, so that I can then play it when images have been loaded.
The carousel is created in html, and so far, in the console, I have tried
but neither of these work.
when I examine the carousel element after calling the pause method, the private property _isPaused = true, but the carousel doesn't stop.
Ideally, I would like the carousel to not autoplay so that when I have received the webworker loaded images, I can then start the carousel cycling.
Mtia...
Beta Was this translation helpful? Give feedback.
All reactions