# 07.轮播图
[toc]{type: "ol", level: [3]}
### 轮播图
```html
<div id="carouselExampleCaptions" class="carousel slide w-100" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="1"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="2"></li>
</ol>
<div class="carousel-inner h-100 w-100">
<!--图文1-->
<div class="carousel-item active">
<img src="../img/carousel-1.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>First slide label</h5>
<p>Some representative placeholder content for the first slide.</p>
</div>
</div>
<!--图文2-->
<div class="carousel-item">
<img src="../img/carousel-2.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>Second slide label</h5>
<p>Some representative placeholder content for the second slide.</p>
</div>
</div>
<!--图文3-->
<div class="carousel-item">
<img src="../img/carousel-3.jpg" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>Third slide label</h5>
<p>Some representative placeholder content for the third slide.</p>
</div>
</div>
</div>
<!--上一个按钮-->
<button class="carousel-control-prev" type="button" data-target="#carouselExampleCaptions" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</button>
<!--下一个按钮-->
<button class="carousel-control-next" type="button" data-target="#carouselExampleCaptions" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</button>
</div>
```
```js
// 设置轮播时间
$('.carousel').carousel( {interval:6000})
```
![轮播图-轮播图-1](07.轮播图-轮播图-1.png)
![轮播图-轮播图-2](07.轮播图-轮播图-2.png)
![轮播图-轮播图-3](07.轮播图-轮播图-3.png)