In this tutorial will show you how to add a "toggle all" open / close button that will open or close all the Elementor toggle that are in a given section or container.
See the demo here:
Features:
- Toggle all the toggles open or closed
- Change the colors of the toggle all button to your liking
- It works with sections and containers
- It works for two or more sets of toggles in the same section / container (as seen in the demo)
- You can have other independent sections / containers with toggle all buttons, that will control their own set of toggles
- Updated to work with the new Accordion element, still works for the older Toggle element
Let's get started!
First, prepare your page with Elementor toggles
This is a premium tutorial. Purchase access to unlock the full tutorial.
17 Responses
Thanks for the tutorial. I may be missing it in the code, but is there a way to default to all toggles open on page load?
You can add this line of code :
Right here :
Let me know if that works!
Works perfectly - thanks for the quick response
HI Maxime. I have found this tutorial really useful on a number of websites. Thanks so much.
On a page I am just building, I use toggles for FAQs and the code you provided. All FAQs are open on page load. Now, I need to link text on the same page to specific FAQs. I tried the code you provide here - https://element.how/elementor-open-specific-tab-toggle-accordion/. It works, but the toggle closes instead of remaining open. I am not a coder. Thanks for any help you can provide.
Greetings!
Delete this line in the code:
Cheers!
Works perfectly - thanks Maxime.
That is, in the code from that other tutorial. Not from the current tutorial.
Hey there -
This is *almost* very very helpful! But I have a long page full of toggles that are divided into multiple sections and inner sections. Is there a way to make this work without redesigning the entire page layout? Thanks!
https://yardeniid.wpengine.com/our-charts/
Hey Steve!
Use this code instead:
Cheers!
Thanks, Maxime! I found a very similar solution myself.
Cheers! Great content here.
Nevermind, I figured it out. I would like to post the adjusted JS for anyone else to use, but I am getting a 403 error when trying to comment it here.
Hey Steve!
You can share your JS, just omit the script tags!
Cheers!
Hi, unfortunately the switch does not work for me. Do I have to assign an ID or class to the accordion?
Hey Tobias,
Did you follow all the instructions closely? Could you share your URL, I will have a look why it's not working for you
Cheers!
Hello Maxime,
Somehow this isn't working for me.
Could you please check what I did wrong?
Greetings Holger,
Sorry I 'm not certain why it's not working, could you please try switching to the older Toggle element by disabling the new nested elements temporarily under WP > Elementor > Settings > Features?
That one should work as expected, if not let me know!
Cheers!
Good morning, Maxime
I deactivated the new nested elements and then used the old toggle element. Unfortunately, that doesn't work either.
This means: If the accordion is closed and I click the toggle, only the first item opens.
Best regards