轮播是一个循环的幻灯片:
如何创建轮播
以下实例创建了一个简单的图片轮播效果 :
实例
<div id="demo" class="carousel slide" data-ride="carousel">
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://static.zyiz.net/images/mix/img_fjords_wide.jpg">
</div>
<div class="carousel-item">
<img src="https://static.zyiz.net/images/mix/img_nature_wide.jpg">
</div>
<div class="carousel-item">
<img src="https://static.zyiz.net/images/mix/img_mountains_wide.jpg">
</div>
</div>
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
轮播图片上添加描述
在每个 <div
class="carousel-item"> 内添加 <div class="carousel-caption"> 来设置轮播图片的描述文本::
实例
<div class="carousel-item">
<img src="https://static.zyiz.net/images/mix/img_fjords_wide.jpg">
<div class="carousel-caption">
<h3>第一张图片描述标题</h3>
<p>描述文字!</p>
</div>
</div>