Close Accordion When Clicked Outside

I created an accordion by following this: Create a custom accordion | Webflow University

It works, I’d like the accordion to close when the user clicks anywhere outside of the accordion.

Is there a way I can do that?

I can’t use dropdown or other cloneable projects.

Hi @ajk9044,

The best way to do it is by creating an animation that closes all the dropdowns/accordions and assigns them to the section element or the external element.

You need to make sure the accordion is not inside the element it will close it because it will create a conflict when it opens.

Let me know if this helps, you can also share a link to your project.