How to use carouselExampleIndicators in image slider




HTML)

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<div class="container">
  <div class="row">
    <div class="col-xs-12 col-md-8 col-md-offset-2">
      <div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="5000">
        <!-- Indicators -->
        <ol class="carousel-indicators carousel-indicators--thumbnails">
          <li data-target="#carousel-example-generic" data-slide-to="0" class="active">
            <div class="thumbnail">
              <img src="http://www.fillmurray.com/800/400" class="img-responsive">
            </div>
          </li>
          <li data-target="#carousel-example-generic" data-slide-to="1">
            <div class="thumbnail">
              <img src="http://www.fillmurray.com/800/401" class="img-responsive">
            </div>
          </li>
          <li data-target="#carousel-example-generic" data-slide-to="2">
            <div class="thumbnail">
              <img src="http://www.fillmurray.com/800/402" class="img-responsive">
            </div>
          </li>
        </ol>

        <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
          <div class="item active">
            <img src="http://www.fillmurray.com/800/400" width="800" height="400">
            <div class="carousel-caption">
              Slide 1
            </div>
          </div>
          <div class="item">
            <img src="http://www.fillmurray.com/800/401" width="800" height="400">
            <div class="carousel-caption">
              Slide 2
            </div>
          </div>
          <div class="item">
            <img src="http://www.fillmurray.com/800/402" width="800" height="400">
            <div class="carousel-caption">
              Slide 3
            </div>
          </div>
        </div>

        <!-- Controls -->
        <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
          <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
          <span class="sr-only">Previous</span>
        </a>
        <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
          <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
          <span class="sr-only">Next</span>
        </a>
      </div>
    </div>
  </div>
</div>


CSS)
.carousel-indicators.carousel-indicators--thumbnails li {
  width: 80px;
  height: 40px;
  margin: 0;
  border: none;
  border-radius: 0;
}
.carousel-indicators.carousel-indicators--thumbnails .active {
  background-color: transparent;
}
.carousel-indicators.carousel-indicators--thumbnails .active .thumbnail {
  border-color: #337ab7;
}

No comments