2017-05-18 3 views
0

Wie kann ich alle Artikel innerhalb dieser Owl carousel haben die gleiche Höhe (als der höchste Gegenstand)?Owl Karussell Artikel haben unterschiedliche Höhen

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

+0

Mögliche Duplikat [Bild Schieber: für alle Bilder gleich hoch zu halten, während Schieber halten ansprechbar] (http: // Stackoverflow .com/fragen/21574698/image-slider-instandhaltung-gleich-höhe-for- all-images-while-keeping-slider-respo) – showdev

Antwort

0

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

+0

Das Ergebnis ist nicht was ich will. Die Höhe Ihrer Bilder ist noch unterschiedlich. Und Sie haben die Bildhöhe auf 500px festgelegt? Dann habe ich Angst, das Verhältnis ist verzerrt, Danke für deine Bemühungen jedenfalls. –

+0

Sie müssen die gleichen proportionierten Bilder (in Höhe und Breite) für bessere Qualität anwenden, sonst scheint es verzerrt zu sein. ich lege Höhe 500 nur als Beispiel –

Verwandte Themen