X-Theme Accordion Toggle Button (all open / close Button for one accordion)

Hi there,

as I searched a lot of threads in the old forum (themeco) and not founding anithing about in Apex I try now to solve this challenge with you::

I want to add a button (or link) aboce an x-accordion to first open and on second click closing all accordion-items in the accordion placed unerneath. As I have mor then one on the page I will work with more Buttons (one fpor each accordion).

  1. Clicking Button -> accordion items opening all.
  2. Clicking again -> accordion closes all.

I tryied three JS scripts. One for opening each acc-item over id. One opening all accordion items on page and one opening over trigger. All of them seems to don’t work in my enviroment. Can you help out?

In next post I provide personal credentials to look up in the development site, so you can check it. thnak you for assisting many of us who want a solution to this.

begeistert

My Credentials:

Hi There @begeistert

Thanks for writing in! Basically accordion functionality has been changed with recent updates.

So I have added the following JavaScript code into your custom JS area.

(function($){
  $('.toggle-accordion').on('click touchstart',function(){
    $('button.x-acc-header').trigger('click');
  });
})(jQuery);

Then I have assigned the following CSS class toggle-accordion into your button. That should open/close all accordion items when clicking on the custom button.

Make sure to clear your browser cache before testing.

Thanks!

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