Offset calculation when slideCount == slidesToShow
See original GitHub issueHi Ken,
First of all thanks for this superb plugin, really appreciated!
I ran into problems with v1.3.15 (v1.4 and v1.4.1 don’t seem to fix it either), when my SlideCount was equal to SlidesToShow (and CenterMode = true and Infinite = true). In this case it was showing only 4 out of 5 slides because on the left a extra margin was added with translate3D.
When looking through your code i found the problem in the getLeft() function.
if (_.slideCount <= _.options.slidesToShow){
_.slideOffset = 0;
verticalOffset = 0;
}
Ok, so now the slideOffset = 0;
if (_.options.centerMode === true && _.options.infinite === true) {
_.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
} else if (_.options.centerMode === true) {
_.slideOffset = 0;
_.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
}
So now the slider gets added 1 slideWidth as Offset on the left side, ergo: showing 4 of 5 slides (last one is “hidden”), while this should be no Offset.
Is this something you can fix for upcomming versions?
Issue Analytics
- State:
- Created 9 years ago
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Offset calculation when slideCount == slidesToShow - Drupal
The slider appears to be off-center and only shows one item. It sounds a common issue with the lack of slide amount compared...
Read more >Slick Slider Starting With A Left Offset - ADocLib
I have a problem with the slider when the view filter is set to a date greater than double post #2489358: Offset calculation...
Read more >Slick slider starting with a left offset - Stack Overflow
I am working on a template which is bootstrap based. I need to set up a full width slick slider, but its initial...
Read more >Swiper API
Add (in px) additional slide offset in the end of the container (after all slides) ... Enable this feature to calculate each slides...
Read more >Center mode slick slider. you can add this to your SCSS file to ...
centerMode: true, centerPadding: '50px', slidesToShow: 3, dots: true, ... 2015 Offset calculation when slideCount == slidesToShow kenwheeler closed this as ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve managed to modify the
getLeft()
function so that it calculates and centres correctly based on whetherslideCount
is less than or equal toslidesToShow
.on line 1037 I modified the if statement from
to
Now the behaviour of the slide is as follows.
If slideCount is less than or equal to slideToShow centre the overall width of all items, else centre to the currently active slide.
Fixed in #2118.