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.

Using slick inside of a flexbox element causes slick to grow exponentially

See original GitHub issue

If you initialize a slick carousel inside of a flexbox element, then the slick carousel increases it’s width exponentially. The carousel ends up being extremely wide!

I know that flexbox is not quite ready for production, but Bootstrap 4 is shipping with the option to enable flexbox framework-wide. If this is something easy to fix, then perhaps it would be worthwhile to do so for us early adopters of Bootstrap 4 😃

http://jsfiddle.net/derekfoulk/x3Luhwqm/1/

Steps to reproduce the problem

  1. Wrap your carousel element with an element
  2. Set display: flex; on that element

What is the expected behaviour?

I expected the slick carousel to stay @ 100% width of the flexbox element.

What is observed behaviour?

The slider starts out much wider than the parent (flexbox) element, and continues to grow wider after each iteration of the carousel.

More Details

  • I have verified this behavior on current & recent versions of Chrome, Firefox & Edge
  • Using slick v1.6.0
  • I’m unsure if this has worked as intended with previous versions of slick

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:16
  • Comments:31

github_iconTop GitHub Comments

98reactions
anrananrancommented, Jan 5, 2018

@alamowo , In fact, “overflow:hidden;” add to the “flex:1” div (not the “slick-slider” div) fixed this bug In my case.

78reactions
Oleksandr07commented, Mar 23, 2018

for flexbox is solved by adding to the parent element { min-width: 0; }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Slick slider not working in a flex container - Stack Overflow
in a column. So I use display: flex; align-items: center; on the column (container of the slick slider) but it breaks the slider....
Read more >
Slick Slider in Felxbox Fix - Addison Legere
Have a container around your slider inside of your flexbox and you should be all set.
Read more >
views.view.html.twig - usage of row class [#3057897] - Drupal
For example I am using a Slick carousel view with Barrio theme and ... slick inside of a flexbox element causes slick to...
Read more >
Slick Slider/Edge-To-Edge Movement - ADocLib
Using slick inside of a flexbox element causes slick to grow exponentially. slick. 20 June 2016 Posted by DerekFoulk. If you initialize a...
Read more >
Create slick CSS layouts with Flexbox - Creative Bloq
We've turned the section into a 'flex container'. The elements in a flex container are flex items and adhere to the rules of...
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