Closing an accordion item using a link/button

Is there a way to close an open accordion item using a link/button? It seems the toggle hash only can trigger to open an accordion item, or?

The idea is, to have a “read more” as single item accordion below a short text and once it’s open there will be a button “show less” at the end of that accordion item… so, clicking this will close that accordion item again.

I know I can do that via jquery, but just curious if it’s doable with cornerstone only :slight_smile:

best regards
Mirco

Hi Mirco,

Thanks for reaching out.
What you are expecting requires some customization. I would suggest you hire a developer who can assist you to do the customization or you can avail of our newly launched service called One, where we answer the questions beyond normal theme support.
Alternatively, you can check the following thread, which might help you with this.

Please remember that the above code will work if copied as it is and doesn’t conflict with any existing style.
Please note that the code provided serves only as a guide to help you get started custom coding on your own if there’s no option offered in our theme or the products we bundle.
We really do not provide support for custom codes which means we can’t fix it in case it conflicts with something on your site nor will we enhance it. Further customization should be directed to a third-party developer or you can avail of One, where we answer the questions beyond normal theme support.

Thanks

Thanks @tristup.

I hoped it’s possible by just using the toggle hash, which I understand as turn on / turn off, but it can only trigger the opening it seems. Maybe something for a future feature? :slight_smile:

The JS I’ve already found and I’m probably going to use that. Just have to adapt it to be used on 8 different accordions on the same page as I’m planing to use the accordion as a “read more” function (extended view of the bio of people).

Best regards
Mirco

Hi Mirco,

That’s great. I’ll add this as feature request so that it will be taken into action in the future.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.