<div class="box">
<div class="slider">
<div class="slide"><span>slide 1</span></div>
<div class="slide"><span>slide 2</span></div>
<div class="slide"><span>slide 3</span></div>
<div class="slide"><span>slide 4</span></div>
<div class="slide"><span>slide 5</span></div>
<div class="slide"><span>slide 6</span></div>
</div
</div>
body {
background-color: #ccc;
margin: 0;
padding: 0;
}
.box {
position: relative;
max-width: 80%;
margin: 0 auto;
}
.slider {
position: absolute;
left: 0;
right: 0;
top: 0;
z-index: 10;
}
.slide {
text-align: center;
box-sizing: border-box;
height: 40vh;
background-color: yellow;
border: 1px solid #000;
cursor: pointer;
display: flex !important;
align-items: flex-end;
justify-content: center;
padding-bottom: 20px;
font-size: 30px;
min-height: 300px;
transition: .5s all;
transform: scale(.5);
}
.slick-now .slide {
background-color: rgb(70, 174, 125);
transform: scale(1);
}
$('.slider').slick({
slidesToShow: 2,
slidesToScroll: 1,
dots: true,
focusOnSelect: true
});
$('.slider').on('beforeChange', function(event, { slideCount: count }, currentSlide, nextSlide){
let selectors = [nextSlide, nextSlide - count, nextSlide + count].map(n => `[data-slick-index="${n}"]`).join(', ');
$('.slick-now').removeClass('slick-now');
$(selectors).addClass('slick-now');
});
$('[data-slick-index="0"]').addClass('slick-now');