【发布时间】:2018-08-11 10:30:09
【问题描述】:
我在使用新的 bootstrap 4 时遇到了问题,你们有谁知道如何在一个页面中添加/插入多个引导轮播。
我搜索了很多网站,但他们只使用 bootstrap 3 给出答案。 提前感谢您的帮助!
【问题讨论】:
-
显示一些你写的代码,它将帮助我们解决你的问题
标签: javascript html css bootstrap-4
我在使用新的 bootstrap 4 时遇到了问题,你们有谁知道如何在一个页面中添加/插入多个引导轮播。
我搜索了很多网站,但他们只使用 bootstrap 3 给出答案。 提前感谢您的帮助!
【问题讨论】:
标签: javascript html css bootstrap-4
演示页面本身使用多个轮播。除了用唯一的 id 定义每个轮播之外,您无需做任何特别的事情。
这是来自文档:"Be sure to set a unique id on the .carousel for optional controls, especially if you’re using multiple carousels on a single page."
https://v4-alpha.getbootstrap.com/components/carousel/
<div id="thisShouldBeUniquePerCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img class="d-block img-fluid" src="..." alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="..." alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="..." alt="Third slide">
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
【讨论】:
您需要为每个轮播提供唯一的 ID, 有关更多信息,您可以访问官方 bootstarp 轮播文档here
【讨论】: