The Carousel plugin is used to create a slideshow or image gallery that can be cycled through ("showcase") to show a large amount of images with or without captions in a user friendly interface. It has three main components:
<style>
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
width: 90%;
margin: auto;
} .carousel-caption {background-color:rgba(0,0,0,0.50); color:white; border-radius:10px; margin-bottom:10px;}
.carousel-caption h3 {color:white;}
</style> </html>
<body> <div id="myCarousel" class="carousel slide" data-interval="3000" data-ride="carousel">
<!-- Container for Carousel items -->
<div class="carousel-inner">
<div class="item active">
<img src="images/flowers/african_violets.jpg" alt="African Violets">
<div class="carousel-caption">
<h3>AFRICAN VIOLETS</h3>
<p>African Violets info goes here...</p>
</div>
</div>
<div class="item">
<img src="images/flowers/Bird_Of_Paradise.jpg" alt="Bird of Paradise">
<div class="carousel-caption">
<h3>BIRD OF PARADISE</h3>
<p>Bird of Paradise info goes here...</p>
</div>
</div>
<div class="item">
<img src="images/flowers/sun_flowers.jpg" alt="Sun Flowers">
<div class="carousel-caption">
<h3>SUN FLOWERS</h3>
<p>Sun Flowers info goes here...</p>
</div>
</div>
</div>
<!-- Carousel indicator dots -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Carousel nav -->
<a class="carousel-control left" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="sr-only">Previous</span>
</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Previous</span>
</a>
</div>
There are some additional options that can be set via classes:
Class | Description |
---|---|
data-interval | specifies the amount of time to delay (in milliseconds) between slides. Default is 5000. |
data-pause | pauses the the carousel on mouse enter and resumes the the carousel on mouse leave. Default is hover. |
data-wrap | specifies whether the carousel should cycle continuously. Default is a boolean set to true. |
data-keyboard | specifies whether the carousel should react to keyboard events. Default is a boolean set to true. |