If slidesToShow is more than one, slide width calc is incorect
See original GitHub issueI am placing few divs inside slides and they come with a 1px border I also used this approach to separate the slides
.slick-slide {
margin-left:40px;
}
/* the parent */
.slick-list {
margin-left:-40px;
}
https://github.com/kenwheeler/slick/issues/582#issuecomment-61882540
now if slidesToShow are set at odd number the width of the slides is wrong and is not taking in count the inside div border , so the last item border is not visible and you can see this here ,
or live example https://jsfiddle.net/fmo50w7n/346/
If I change the slidesToShow to 2 https://jsfiddle.net/fmo50w7n/347/
the division is ok and last item border is visible.
Now this is just an example of particular space between slides + border but my slick is going to be used by multiple users and I cannot guess if they will have the border inside and what size that border will be. Looks to me like the width calc is not taking everything in count or it simply cannot divide odd number properly so it rounds it up.,
Any help is appreciated.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8
Top GitHub Comments
Ohhh you know what this is? It’s the same as #2167.
I’m not 100% on the browser constraints related to this, but basically sometimes there’s a discrepancy between
sildeWidth
*slideCount
andsliderWidth
. Logged to the console in a modified version of your fiddleGonna keep the other one as the primary for this issue. Thanks @danyj
Check this: https://jsfiddle.net/bja34r13/
And here’s the setDimensions method: https://github.com/kenwheeler/slick/blob/master/slick/slick.js#L1913