Answer the question
In order to leave comments, you need to log in
Using slick slider with border?
Good afternoon. This is not the first time I've used the slick slider. From what I understand, it's quite popular. Faced a problem now. Slider elements have borders. So there is a feeling that the calculation of the width of the element goes without taking them into account, so the last border on the right is swallowed. Question: how can this problem be overcome?
Answer the question
In order to leave comments, you need to log in
The solution is simple, just don't add margin and border to the element that slick adds the .slick-slide class to.
In other words, wrap all slides with a div without styles.
...
<div class="slick-slide"> <!-- этому блоку не добавляем отступы и border-->
<div class="slide__inner"> <!-- добавляем блок внутрь здесь можно делать всё что нужно -->
...
</div>
</div>
...
Yes the code is simple
<div class="info-panel-content-tab-content-items">
<a class="info-panel-content-tab-content-item" href="#">
<div class="info-panel-content-tab-content-item-delete">
<div class="ico"></div>
</div>
<span class="info-panel-content-tab-content-item-img" href="#"><img src="img/info.jpg" alt="инфо"></span>
<span class="info-panel-content-tab-content-item-title">Phantom PH1110 с фонарем</span>
<span class="info-panel-content-tab-content-item-price">8 960 р.</span>
</a>
<a class="info-panel-content-tab-content-item" href="#">
<div class="info-panel-content-tab-content-item-delete">
<div class="ico"></div>
</div>
<span class="info-panel-content-tab-content-item-img" href="#"><img src="img/info.jpg" alt="инфо"></span>
<span class="info-panel-content-tab-content-item-title">Phantom PH1110 с фонарем</span>
<span class="info-panel-content-tab-content-item-price">8 960 р.</span>
</a>
</div>
$('.info-panel-content-tab-content-items').slick({
slidesToShow: 8,
slidesToScroll: 1,
swipe: false
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question