Accordion with Transition doesn't close already-opened Tabs

I added a simple transition to the webflow accordion with Height=0px to Height=auto …
Of course this wont close already-opened Tabs when clicking twice.

How can i achieve to close already-opened tabs when opening another tab?


http://wedoo.webflow.io/ (Frontpage last Section)
https://webflow.com/design/wedoo

Hello @wedo

In the interaction that opens the accordion add some steps to close all accordions prior to opening the current one.

Make sure the close steps apply to all elements of that class and the open steps only apply to the current element.

Hope that helps. Happy designing!

Hey @matthewpmunger

Thanks for your reply, I tried that already and didn’t succeed, because I can’t select on one DIV (which opens and closes) at one interaction-command “on all elements” and on the other “only children with this class”.
See Screenshot:

2 Likes

Duplicate the interaction and split the steps. Have each one trigger on click of the accordion.

  • One interaction to close all accordions (affect class)
  • One interaction to open current accordion with a delay to give the first interaction to finish (affect current element)

Maybe try this.

Uh, yeah it almost works @matthewpmunger

Bug:

Open first row. Then open second row. First row closes nicely. Then click on first row again. Nothing happens, damn. Clicking second time on first row Row opens nicley.

Why doesnt it open on the second click on the same row?

http://wedoo.webflow.io/

Please share the read-only link and I can take a closer look later. Thanks.

https://preview.webflow.com/preview/wedoo?preview=9aae6d86ab613471f9f2323aa4aaf9f8

Thank you!!

There shouldn’t be any actions on the 2nd click.

Other than that, it’s working for me. Do you see something different?

THAAAAAAAAAAANNNNNKKKKKKKK YOUUUUUU!!!

It’s working perfectly.

Ahhh, but now I’m not able to close it anymore on second click :-/
Reproduce: Open a Accordion Row and try to close it again.

1 Like

Having the same issue. It works except you can’t close a currently open accordion by clicking on it. You have to click on another one. Any solution?

No worries @wedo& @fmcausby! I made a cloneable project for an accordion that closes other opened accordions while you are opening a new one without code!

Project Clone: https://webflow.com/website/faq-no-code

https://cl.ly/4dcc6d7b1441

4 Likes

Nice work around for basic use, but It’s a bummer that we can’t change the individual occurrences of an element in an interaction. Has anyone found a way to close all open and then open current with ix? @matthewpmunger?

edit: sort of works, then stops after a few repeats. Native dropdown it is :persevere: https://preview.webflow.com/preview/closing-accordions?utm_source=closing-accordions&preview=d67c3ed33defce508c226f2dd4f3c830

2 Likes