Slides going to multiple lines with variableWidth: true
See original GitHub issueProblem
When using variableWidth: true
the track width is miscalculated when one (or more) of the slides are wider than the container. This results in the track contents overflowing to multiple lines (and the slider becoming very high).
Original slick tackles this by setting the slideWidth always to 5000px when variableWidth is used (cf. https://github.com/kenwheeler/slick/blob/a2aa3fec335c50aceb58f6ef6d22df8e5f3238e1/slick/slick.js#L2081)
Example from examples
This is visible in this example, when you resize the window: https://react-slick.neostack.com/docs/example/variable-width
Issue Analytics
- State:
- Created 5 years ago
- Reactions:17
- Comments:20
Top Results From Across the Web
Developers - Slides going to multiple lines with variableWidth: true -
Problem. When using variableWidth: true the track width is miscalculated when one (or more) of the slides are wider than the container.
Read more >Slick - slides jump with centerMode and variable width
I resolved this issue with a fixed width on all slide with .slick-slide { width:200px; }. and variableWidth: true. I also left centerMode...
Read more >Multiple Rows - React Slick Documentation - neostack
The last react carousel you will ever need.
Read more >slick variable width - CodePen
slick variable width · vicpantoja. Follow. Love Run. Pen Editor Menu. Settings ... <p>Text number 2</p>. 10. </div>. 11. <div class="box">.
Read more >variableWidth doesn't display right [#2490528] | Drupal.org
firstly.. I love slick slider and your (gausarts) great work on that implementation I've done my slick slideshow with thumbslider described ...
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 Free
Top 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
It’s a workaround but adding
display: flex
toslick-track
class seems to fix this issueHi @lorenzos, I discussed the reasoning for this fix in this Twitter thread https://twitter.com/APKoponen/status/1002111012059930624, but I’ll reiterate it here.
The original slick.js library had a more “robust” implementation for calculating the width of the variable width slides, but it was removed here as it had multiple issues. Not using a fixed value is likely to cause similar issues also with this react implementation.
The fixes this issue for 90% of the cases and is a much better option than the current broken behavior. Also, it is only a small, 1 line change in the code, which is easy to review. As you might have noticed, the contributors & owners of this library are quite busy so I’ll settle with this fix, if we could get even it to be merged.
If someone is interested in creating a better solution and thoroughly testing it with multiple corner cases they are free to do it, but I would like to see this first fix merged first and not wait for something that is quite likely not to happen.