display: flex prevent carousel to scroll
See original GitHub issueThis codesandbox example doesn’t scroll well on latest chrome. I think it’s because of display: flex
on container div.
It may be documented or bypassed.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Carousel slider with flexbox, preventing horizontal scroll
I'm trying to make carousel slider using flexbox. The issue is that I need to show only 4 items and prevent scrolling, while...
Read more >display: flex prevent carousel to scroll · Issue #106 - GitHub
This codesandbox example doesn't scroll well on latest chrome. I think it's because of display: flex on container div.
Read more >Basic concepts of flexbox - CSS: Cascading Style Sheets | MDN
This is why when we just declare display: flex on the parent to create flex items, the items all move into a row...
Read more >Carousel - Bootstrap
The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms and a bit of JavaScript. It...
Read more >CSS-Only Carousel - CSS-Tricks
CSS-Only Carousel · Setting some boxes in a horizontal row with CSS Flexbox is easy. · Showing only one box at a time...
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
Yeah it’s good starting point and I got a hint from it.
.embla__viewport { width: 100%; }
was what I need.I just started from this snippet and it misses width designation. It was my RTFM lesson but when I see the examples at first what hit my head was ‘do I really need all of them? It must be a showcase.’. So I started from that snippet.
I changed my thought
.embla__viewport
and.embla__container
is necessary entirely. Anyway your example was helpful.Thanks for clarifying @jeiea. I understand what you mean now.
As you mention and have observed already, both the viewport with the
overflow: hidden;
and the container is necessary for Embla Carousel to work properly. And this is because the single wrapper approach would mean that each and every slide has to be animated in order to scroll the carousel (like keen-slider), as opposed to Embla Carousel which only animates one element (the container holding the slides). The single wrapper approach doesn’t scale well from a performance perspective, for example if you have a lot of slides, animating each and every one would cause a noticeable performance hit.I hope my explanation makes sense.
Kindly David