I ran into an interesting issue. I'm pretty sure that the answer is very simple, but I just couldn't figure it out so I thought I look for some help.
Basically, my carousel doesn't slide. It just switches image. I even tried copying the exact HTML from the bootstrap site into my own page and it still doesn't slide. In application.js, the initialization is also has no argument.
// carousel demo $('#myCarousel').carousel()
I notice that next and prev classes are added to each item when clicking pref/next button, but it doesn't seem to do the same thing on mine. I didn't see anything wrong when I debugged either.
What am I missing? I tested this in both latest Chrome and Safari.
Bootstrap uses their JavaScript util functions to make the carousel operate when a user clicks on the controls. In this code snippet below, you'll see a previous and a next arrow on either side of the image.
carousel({ interval: false, }); That will make the auto sliding stop because there no Milliseconds added and will never slider next.
In browsers where the Page Visibility API is supported, the carousel will avoid sliding when the webpage is not visible to the user (such as when the browser tab is inactive, the browser window is minimized, etc.).
You can simply use the data-interval attribute of the carousel class. It's default value is set to data-interval="3000" i.e 3seconds. All you need to do is set it to your desired requirements.
You also have to add bootstrap-transition
for the sliding to work, like so:
<script src="twitter-bootstrap-v2/docs/assets/js/bootstrap-transition.js"></script>
I was having the same issue but with bootstrap v2.0.3 (which has transition bundled in), ended up adding the slide class to the carousel div
<div id="myCarousel" class="carousel slide">
then you just call:
$('#myCarousel').carousel();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With