Streaming live at 10am (PST)

Closing Accordion

HI,

So I have made and accordion, by following the lesson “Create a custom accordion”.

My question is: After you trigger the content to open, can you have it close by selecting a different trigger than the one that was used to open it to begin with.

Example:
This is how it currently works:

Trigger 1
- Opens Content 1 (First Click)
- Closes Content 1 (Second Click)
Trigger 2
- Opens Content 2 (First Click)
- Closes Content 2 (Second Click)
Trigger 3
- Opens Content 3 (First Click)
- Closes Content 3 (Second Click)

This is how I want it to work:

Trigger 1
- Opens Content 1 and Closes Open Content from 2 and 3 (First Click)
- Closes Content 1 (Second Click)
Trigger 2
- Opens Content 2 and Closes Open Content from 1 and 3 (First Click)
- Closes Content 2 (Second Click)
Trigger 3
- Opens Content 3 and Closes Open Content from 1 and 2 (First Click)
- Closes Content 3 (Second Click)

I want to be able to click on trigger 1 and view its content then click on trigger 2 and it close trigger 1’s content and opens trigger 2’s content.

Last I should note that I am using a collection list for all the content and names of the triggers. So the name of the collection item is the trigger and the content is other content in the collection item.

Thanks,


Here is my public share link: LINK
(how to access public share link)

@Ben1 Were you able to figure this one out? I am looking to build the same effect :slight_smile:

Your link above doesn’t seem to be working btw

I found an answer from a post in 2018. I am using the JavaScript version.

At the time of making the post I really didn’t have anything so I left the link blank.