【问题标题】:Add multiple bootstrap 4 carousel on a single page在单个页面上添加多个 bootstrap 4 轮播
【发布时间】:2018-08-11 10:30:09
【问题描述】:

我在使用新的 bootstrap 4 时遇到了问题,你们有谁知道如何在一个页面中添加/插入多个引导轮播。

我搜索了很多网站,但他们只使用 bootstrap 3 给出答案。 提前感谢您的帮助!

【问题讨论】:

标签: javascript html css bootstrap-4


【解决方案1】:

演示页面本身使用多个轮播。除了用唯一的 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>

【讨论】:

    【解决方案2】:

    您需要为每个轮播提供唯一的 ID, 有关更多信息,您可以访问官方 bootstarp 轮播文档here

    【讨论】:

      猜你喜欢
      • 2015-09-29
      • 1970-01-01
      • 2021-08-31
      • 1970-01-01
      • 1970-01-01
      • 2012-08-23
      • 1970-01-01
      • 2020-08-18
      • 1970-01-01
      相关资源
      最近更新 更多