question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

center mode not working when slides are equal to slidesToShow

See original GitHub issue

Hi, I’m using slicker but I have a problem.

I have:

         <div class="thumbnail-gallery-container">

                <div class="thumbnail ">
                    <img src="../images/one.png" alt="pic_one" />
                </div>
                <div class="thumbnail ">
                    <img src="../images/two.png" alt="pic_two" />
                </div>
                <div class="thumbnail ">
                    <img src="../images/three.png" alt="pic_three" />
                </div>        
            </div>

$thumnailContainer.slick({ slidesToShow: 3, slidesToScroll: 1, arrows: true, infinite: true, dots: false, centerMode: true, focusOnSelect: true, variableWidth: true });


The problem is that when I have the same number of slides and slidesToShow, the div “slider-track” have an inline style of “transform: translate3d(137px, 0px, 0px);” and that makes that this is not center.

This is how it look 3slides

But when I have 4 slides and slidesToShow = 3, it looks fine: 4slides

Is there any way that I can make this 3 slides respect the center mode and not adding the "“transform: translate3d(137px, 0px, 0px)” when numberOfSlides == slidesToShow ??

Thank you!!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
NicoleMarieBRFRcommented, Apr 1, 2020

Hi, I fixed this problem with some css !!

.slider { width: 80%; margin: 100px auto; }

.slick-slide { margin: 10px 20px; }

.slick-slide img { width: 100%; transform: scale(0.9); }

.slick-prev:before, .slick-next:before { color: black; } .slick-dotted .slick-center img { transform: scale(1.1);

}

@flinch85 @laurentmor

0reactions
flinch85commented, May 7, 2019

Hello, this problem still stands. Any fix yet? Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Slick slider centermode not working when more slides than ...
slide elements) is less than or equals to the value of the slidesToShow option, the slides will not be cloned and the centerMode...
Read more >
Center mode doesn't show next and previous slide - Drupal
Hi gausarts! I managed to make it work but for anyone having the same problem: Other relevant settings: Center mode = ON Infinite...
Read more >
slick - the last carousel you'll ever need - Ken Wheeler
... centerMode: true, centerPadding: '60px', slidesToShow: 3, ... To use lazy loading, set a data-lazy attribute // on your img tags and leave...
Read more >
Slick slider center mode with 2 slides. Number of Slides to Show
Working fiddle here: Slick slide - two slides in center mode Share Follow ... new syntax center mode not working when slides are...
Read more >
kenwheeler/slick - Gitter
Has anyone else had the same problem? Karolína Vyskočilová ... i have a small probleme on slick slider with max-width of slick-slide ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found