Avika Avika -4 years ago 37
HTML Question

I am trying to apply carousel to multiple images in one carosel.The carousel is not moving. help me

<html>
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="CustomStyles.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12">
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false">
<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>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-xs-4">

<img src="1.jpg" class="img-responsive">
</div>
<div class="col-xs-4">
<img src="2.jpg" class="img-responsive">
</div>
<div class="col-xs-4">
<img src="3.jpg" class="img-responsive">
</div>
</div>
</div>
</div>


<a class="left carousel-control" href="#theCarousel" data-slide="prev"><i class="glyphicon glyphicon-chevron-left"></i></a>
<a class="right carousel-control" href="#theCarousel" data-slide="next"><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
</div>
</div>
</div>


</body>
</html>/*i am not able apply carousel to multiple images in one carousel. give an instruction


//i am not able apply carousel to multiple images in one carousel. give an instruction
//i am not able apply carousel to multiple images in one carousel. give an instruction
//i am not able apply carousel to multiple images in one carousel. give an instruction
//i am not able apply carousel to multiple images in one carousel. give an instruction*/

Answer Source

I've modified your code little bit. You need to just replace the existing code with the following code:

<html>
<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <link href="CustomStyles.css" rel="stylesheet">
</head>
<body>
      <div class="container">
        <div class="row">
          <div class="col-xs-12">
            <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false">
              <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>
              <div class="carousel-inner">
                                <div class="item active">

              <div class="row">
                <div class="col-xs-4">
                  <img src="1.jpg" class="img-responsive">
                </div>
                <div class="col-xs-4">
                  <img src="2.jpg" class="img-responsive">
                </div>
                <div class="col-xs-4">
                  <img src="3.jpg" class="img-responsive">
                </div>
              </div>

            </div>
            <div class="item">

              <div class="row">
                <div class="col-xs-4">
                  <img src="4.jpg" class="img-responsive">
                </div>
                <div class="col-xs-4">
                  <img src="5.jpg" class="img-responsive">
                </div>
                <div class="col-xs-4">
                  <img src="6.jpg" class="img-responsive">
                </div>
              </div>

            </div>
            <div class="item">

              <div class="row">
                <div class="col-xs-4">
                  <img src="7.jpg" class="img-responsive">
                </div>
                <div class="col-xs-4">
                  <img src="8.jpg" class="img-responsive">
                </div>
                <div class="col-xs-4">
                  <img src="9.jpg" class="img-responsive">
                </div>
              </div>

            </div>
              </div>
            </div>
          </div>

          <a class="left carousel-control" href="#myCarousel" data-slide="prev"><i class="glyphicon glyphicon-chevron-left"></i></a>
          <a class="right carousel-control" href="#myCarousel" data-slide="next"><i class="glyphicon glyphicon-chevron-right"></i></a>
        </div>
      </div>
</body>
</html>

It will work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download