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.

Unable to slide when number of slide items <= slidesToShow and you set initialSlide: 1 (except first one)

See original GitHub issue

First off all, thanks for this amazing slider. I have been using it for a while in various projects and found this issue while trying to achieve certain requirements on a project.

I am trying to achieve sync slider where I can set initialSlide to specific slide. But when number of slide items are less than or equal to slidesToShow, it doesn’t activate slider and also not showing prev and next buttons (as slide items are less or equal than slidesToShow). I am not able to go back to first slide using thumbnails because of this situation. Below are the codepens with different scenarios.

This could probably be duplicate of https://github.com/kenwheeler/slick/issues/1630, https://github.com/kenwheeler/slick/issues/1098, https://github.com/kenwheeler/slick/issues/1504

Let me know what I can do to get this working.

====================================================================

Issue

Below pen is when slide item = slidesToShow, initialSlide = 1 (Not able to slide through to first item from thumbnails) https://codepen.io/cooldhavs/pen/mLxMZa

Works fine

Below pen when everything works if slide item > slidesToShow, initialSlide = 1 https://codepen.io/cooldhavs/pen/BxrdzO

====================================================================

Steps to reproduce the problem

  1. Create sync slider from Slider Syncing example
  2. Keep slide item <= slidesToShow number
  3. Set initialSlide to any slide other than first slide

====================================================================

What is the expected behaviour?

One would expect that it will let you slide if you have initialSlide something other than first slide even though you have less slide items than slidesToShow. That way you can go back to first slide from thumbnails.

====================================================================

More Details

  • slick version "slick-carousel": "^1.6.0",

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
Nitroxidcommented, Jun 13, 2018

I having the same problem. Changing the margin I have on .slick-slide to a border sadly does nothing for me. My workaround for now is, to calculate the slidesToShow like this min(3,imageCount-1) so it is always less than the image count. That fixes the problem with the missing arrows.

Another problem is, that I use CSS to change the opacity of non-active slides. When I have three images the third is being slightly transparent, because I need to set slidesToShow to 2.

It would be nice, if slidesToShow could be at least equal to the number of slides.

The only options I’m using are { slidesToShow: 3, centerMode: true, variableWidth: true, }, Version is 1.8.0

Tested in Firefox 60.0.2 and Chromium 66.0.3359.181 on Ubuntu 18.04

0reactions
YuanWenqingcommented, Apr 27, 2021

@yesiamben Thanks for your solution. We tried a lot of different settings for slider and may miss this one.

But this solution will break when centerMode is set. It forces nav slider to a wrong position. Would you have some idea for that?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Slick slider not working when initialSlide is set - Stack Overflow
Since 2014 initialSlide not working in responsive config, so can use $('.selector').slick('slickGoTo', 5);.
Read more >
slick - the last carousel you'll ever need - Ken Wheeler
In Wordpress, I've implemented Slick-slider using ACF pro. But it's not working very well: basically for a split second the slides all load...
Read more >
react-multi-carousel - npm
Supports images, videos, everything. Responsive; Swipe to slide; Mouse drag to slide; Keyboard control to slide; Multiple items; Show / hide ...
Read more >
Slick slider fewer sides than slidestoshow. 8. $nextarrow ...
Slide One Multiple carousels on one page with one next prev function ... of the number of items I'm showing, I would expect...
Read more >
https://www.aamu.edu/_resources/ldp/galleries/slic...
Data Attribute Settings In slick 1.5 you can now add settings using the ... Unless `autoplay: true`, sets browser focus to current 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