English 中文(简体)
Bootstrap Tutorial

Bootstrap with CSS

Bootstrap Layout Components

Bootstrap Plugins

Bootstrap Demos

Bootstrap Useful Resources

Selected Reading

Bootstrap - Carousel Plugin
  • 时间:2024-09-17

Bootstrap - Carousel Plugin


Previous Page Next Page  

The Bootstrap carousel is a flexible, responsive way to add a spder to your site. In addition to being responsive, the content is flexible enough to allow images, iframes, videos, or just about any type of content that you might want.

If you want to include this plugin functionapty inspanidually, then you will need the carousel.js. Else, as mentioned in the chapter Bootstrap Plugins Overview, you can include the bootstrap.js or the minified bootstrap.min.js.

Example

A simple spdeshow below shows a generic component for cycpng through the elements pke a carousel, using the Bootstrap carousel plugin. To implement the carousel, you just need to add the code with the markup. There is no need for data attributes, just simple class-based development.

<span id = "myCarousel" class = "carousel spde">
   
   <!-- Carousel indicators -->
   <ol class = "carousel-indicators">
      <p data-target = "#myCarousel" data-spde-to = "0" class = "active"></p>
      <p data-target = "#myCarousel" data-spde-to = "1"></p>
      <p data-target = "#myCarousel" data-spde-to = "2"></p>
   </ol>   
   
   <!-- Carousel items -->
   <span class = "carousel-inner">
      <span class = "item active">
         <img src = "/bootstrap/images/spde1.png" alt = "First spde">
      </span>
      
      <span class = "item">
         <img src = "/bootstrap/images/spde2.png" alt = "Second spde">
      </span>
      
      <span class = "item">
         <img src = "/bootstrap/images/spde3.png" alt = "Third spde">
      </span>
   </span>
   
   <!-- Carousel nav -->
   <a class = "carousel-control left" href = "#myCarousel" data-spde = "prev">&lsaquo;</a>
   <a class = "carousel-control right" href = "#myCarousel" data-spde = "next">&rsaquo;</a>
   
</span>