Accordion: Keep item open

Hi,

how can I keep the accordion from closing an item, when another one is opened? The accordion is moving around wildly when an expanded item is collapsed because another one opens.

Thanks!

Does nobody have a solution for this? Should be basic functionality.

I have a custom script using JavaScript and some jquery that does this. It builds the accordion dynamically based on Gutenberg Post content. I can explain further and provide a starting solution (current code is geared toward my needs) when I get to my pc later today.

For now, here’s the accordion codepen that stays open with some extra features.

Another snippet to take a look at

1 Like

@0x7466 any luck integrating either snippet? web-craft’s snippet should get the job done (being more universal)

Hi @blakek,

thanks for your solution. Looks promising, and I will surely try this approach in my next project.

Unfortunately, however, I’ve already built the whole accordion in the default accordion element and the site has been already semi-launched. The customer has already approved on this. It’s just this last piece.

Do you also know if there is a way to hook into the bricks accordion element to prevent the default behavior of closing the previously opened element? Or @timmse maybe?

Thanks!

It’s already in the settings,

Behave Like Tabs: Enable to open & close an item without toggling other items.

1 Like

Oh my god, I forgot to mention that I use the nestable Accordion. There isn’t such an option, unfortunately.

it’s called ‘Independent toggle’ on the nestable one.

2 Likes

Omg I feel so dumb now that I didn’t try that.

Thank you very much!