Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
40
rated 0 times [  42] [ 2]  / answers: 1 / hits: 147776  / 6 Years ago, wed, february 28, 2018, 12:00:00

I'm having trouble with the Slick carousel JS plugin with multiple slidesToShow which have different heights.


I need the Slides to have the same height, but with CSS flex-box it doesn't work as the slides have conflicting CSS definitions.


Also, I didn't find anything useful in the forums and on the web.


HTML


<div class="slider">
<div class="slide">
<p>Lorem ipsum.</p>
</div>
<div class="slide">
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua</p>
</div>
<div class="slide">
<p>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
</div>
<div class="slide">
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr.</p>
</div>
</div>

JS


$('.slider')
.slick({
autoplay: false,
dots: false,
infinite: false,
arrows: false,
slidesToShow: 2,
slidesToScroll: 2,
rows: 0
});

CSS


.slide {
height: 100%;
background-color: #ccc;
padding: 10px;
}

More From » jquery

 Answers
22

Add a couple of CSS styles and it will be ready:



.slick-track
{
display: flex !important;
}

.slick-slide
{
height: inherit !important;
}


Enjoy! :-)


[#55046] Saturday, February 24, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lawrencem

Total Points: 153
Total Questions: 102
Total Answers: 98

Location: Mauritania
Member since Sun, Oct 17, 2021
3 Years ago
lawrencem questions
;