I'm using the slick-carousels
project because I'd like to create some kind of slider that is able to show different images in a row.
So what I'd like to get is something similar to this:
So the carousel includes a bunch of images where 4 of them are shown at the same time while the images are centered (top & bottom got the same values).
But what I get using my code looks exact like this - what a mess:
$(document)
.ready(function() {
$('.carousel')
.slick({
centerMode: true,
centerPadding: '60px',
slidesToShow: 4,
dots: false,
prevArrow: false,
nextArrow: false,
responsive: [{
breakpoint: 768,
settings: {
arrows: false,
centerMode: true,
centerPadding: '40px',
slidesToShow: 3
}
}]
});
});
.carousel {
overflow: hidden;
}
.carousel_slide {
position: relative;
margin-left: 2%;
}
.slick-slide {
float: left;
}
.slick-initialized .slick-slide {
display: block;
}
#card {
position: absolute;
margin-top: 10%;
background-color: darkgray;
border-radius: 16px;
width: 90%;
height: 30%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<div id="card">
<div class="carousel" data-slick='{"slidesToShow": 4, "slidesToScroll": 4}'>
<div class="" style="slide">
<img style="margin: auto; top: 0; bottom: 0; width: 100%" src="http://www.stickpng.com/assets/images/580b585b2edbce24c47b290b.png">
</div>
<div class="carousel_slide">
<img style="margin: auto; top: 0; bottom: 0; width: 100%" src="http://www.stickpng.com/assets/images/580b585b2edbce24c47b290b.png">
</div>
<div class="carousel_slide">
<img style="margin: auto; top: 0; bottom: 0; width: 100%" src="http://www.stickpng.com/assets/images/580b585b2edbce24c47b290b.png">
</div>
<div class="carousel_slide">
<img style="margin: auto; top: 0; bottom: 0; width: 100%" src="http://www.stickpng.com/assets/images/580b585b2edbce24c47b290b.png">
</div>
</div>
Edit:
How to edit my code to achieve the expected result? Any help would be very appreciated.