Accordions open/close all
-
Hello dear supporters,
I use the accordion block and would like to open and close all panels simultaneously with one button. Some time ago a solution was already posted, which unfortunately does not work well with 20+ panels. A .click() event takes too much time to finish with the slide animations. There is already an “openAll” key in the plugin code. Is it possible to call this directly?
Unfortunately, my previous solution doesn’t work, because when clicking on a single panel, all previously expanded panels are closed or at least get the “kt-accordion-panel-hidden” class (even though this block setting has already been disabled). It seems like my code is being overwritten.My idea:
function expandAll($this) { $this.find('.kt-accordion-header-wrap button').attr("aria-expanded", 'true' ); $this.find('.kt-accordion-panel').removeClass('kt-accordion-panel-hidden').addClass('kt-accordion-panel-active'); $this.find('.kt-accordion-panel').css({ 'display': 'block' }); $this.find('.kt-accordion-header-wrap button').addClass('kt-accordion-panel-active'); }You can reproduce the problem by going to my linked page and clicking the “alle einklappen” button, then closing a single panel.
Thank you very much for your support
The page I need help with: [log in to see the link]
The topic ‘Accordions open/close all’ is closed to new replies.