Skip to content
Advertisement

How can I keep flex columns from expanding when hidden section opened?

What I’m trying to accomplish is having a hidden section opened by a button (the “Disclosure” button) but when that section expands I don’t want the column next to it to expand as well because there’s no need for it to do so. I feel like it has to be something in the Flex settings but I can’t seem to figure out where I would declare it in such a way that only the one column will expand and ideally push the one below it down without expanding the column to the right of it.

I’m also trying to get the font awesome chevron icon to rotate upon the disclosure content-box having expanded (active state?) but I can’t seem to figure that out either.

Here’s the css, html, and javascript that I’m working with:

JavaScript
JavaScript
JavaScript

Here’s a JS fiddle with all of that included:

https://jsfiddle.net/30j5Loky/102/

Advertisement

Answer

I figured it out. I just needed to add align-items: flex-start; to the parent container and that caused the desired effect: jsfiddle.net/9eg4rkoz

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement