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.

display: flex prevent carousel to scroll

See original GitHub issue

This 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:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jeieacommented, Sep 24, 2020

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.

0reactions
davidjerlekecommented, Sep 25, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

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