最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Add multiple bootstrap 4 carousel on a single page - Stack Overflow

programmeradmin4浏览0评论

I'm having a trouble in using the new bootstrap 4, do anyone of you know how to add/insert multiple bootstrap carousel in one single page.

I've search many sites but they only give answers using bootstrap 3. thank you in advance for your help!

I'm having a trouble in using the new bootstrap 4, do anyone of you know how to add/insert multiple bootstrap carousel in one single page.

I've search many sites but they only give answers using bootstrap 3. thank you in advance for your help!

Share Improve this question asked Mar 3, 2018 at 8:18 Les ter BonLes ter Bon 511 gold badge1 silver badge8 bronze badges 2
  • 1 Possible duplicate of How to stack multiple images in Bootstrap 4 carousel – WebDevBooster Commented Mar 3, 2018 at 8:31
  • Show some code that you have written, it will help us to solve your problem – Zuber Commented Mar 3, 2018 at 8:36
Add a ment  | 

2 Answers 2

Reset to default 3

The demo page itself uses multiple carousels. There's nothing special you have to do except define each carousel with a unique id.

This is from the docs:
"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./ponents/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>

You need to give unique IDs to each carousel, for further information you can visit official bootstarp carousel documentation here

发布评论

评论列表(0)

  1. 暂无评论