如何使此Owl carousel中的所有项目具有相同的高度(与最高的项目相同)?



$(document).ready(function() {
  $('.owl-carousel').owlCarousel({
    items: 4
  });
});

<link href="//cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/assets/owl.carousel.min.css" rel="stylesheet" />
<script src="//code.jquery.com/jquery-3.1.0.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.2.1/owl.carousel.min.js"></script>

<div class="owl-carousel owl-theme">
  <div><img src="http://placehold.it/350x150"></div>
  <div><img src="http://placehold.it/350x100"></div>
  <div><img src="http://placehold.it/350x150"></div>
  <div><img src="http://placehold.it/350x150"></div>
  <div><img src="http://placehold.it/350x150"></div>
  <div><img src="http://placehold.it/350x150"></div>
  <div><img src="http://placehold.it/350x150"></div>
</div>





View on JS Bin

最佳答案

.image{
width:100%;
height:500px
}


  <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>


<div class="container">
  <div id="myCarousel" class="carousel slide" data-ride="carousel">
    <!-- Indicators -->
    <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>

    <!-- Wrapper for slides -->
    <div class="carousel-inner">
      <div class="item active">
        <img src="http://www.gettyimages.com/gi-resources/images/frontdoor/creative/PanoramicImagesRM/FD_image.jpg" alt="" class="image" >
      </div>

      <div class="item">
        <img src="http://i.dailymail.co.uk/i/pix/2016/09/13/14/384A98B300000578-0-image-a-63_1473774825844.jpg" alt=""  class="image">
      </div>

      <div class="item">
        <img src="https://s-media-cache-ak0.pinimg.com/736x/b1/7c/d0/b17cd0554537ceb0e816537bfcae09eb.jpg" alt=""  class="image">
      </div>
    </div>

    <!-- Left and right controls -->
    <a class="left carousel-control" href="#myCarousel" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left"></span>
      <span class="sr-only">Previous</span>
    </a>
    <a class="right carousel-control" href="#myCarousel" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right"></span>
      <span class="sr-only">Next</span>
    </a>
  </div>
</div>

关于css - 猫头鹰旋转木马元素有不同的高度,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44046556/

10-12 02:28