I have a bootstrap carousel on my web page, I'm trying the increase the time interval between each slide. The default delay of 5000 milliseconds is too fast, I need about 10 seconds.
This question is related to
javascript
html
css
twitter-bootstrap
You need to set interval in main div as data-interval tag .
so it is working fine and you can give different time to different slides.
<!--main div -->
<div data-ride="carousel" class="carousel slide" data-interval="100" id="carousel-example-generic">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class=""></li>
i>
</ol>
<!-- Wrapper for slides -->
<div role="listbox" class="carousel-inner">
<div class="item">
<a class="carousel-image" href="#">
<img alt="image" src="image.jpg">
</a>
</div>
</div>
</div>
You can also use the data-interval attribute eg. <div class="carousel" data-interval="10000">
<div class="carousel-inner text-right">
<div class="carousel-item active text-center" id="first" data-interval="1000" >
<img src="images/slide-1.gif" alt="slide-1">
</div>
<div class="carousel-item text-center" id="second" data-interval="2000" >
<img src="images/slide-2.gif" alt="slide-2">
</div>
<div class="carousel-item text-center" id="third" data-interval="3000" >
<img src="images/slide-3.gif" alt="slide-3">
</div>
<div class="carousel-item text-center" id="four" data-interval="5000" >
<img src="images/slide-4.gif" alt="slide-4">
</div>
</div>
You can also change different slides.
The best way to get rid on it is adding or modifying the data-interval attribute like this:
<div data-ride="carousel" class="carousel slide" data-interval="10000" id="myCarousel">
It's specified on ms like it's usually on js, so 1000 = 1s, 3000 = 3s... 10000 = 10s.
By the way you can also specify it at 0 for not sliding automatically. It's useful when showing product images on mobile for example.
<div data-ride="carousel" class="carousel slide" data-interval="0" id="myCarousel">
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.
Source: Stackoverflow.com