Skip to: Expand / Collapse

Awesome Accordions website

Expand / Collapse

To give the panel the needed expand/collapse effect we created a script. This will expand/collapse the panel and also uses tabindex for screen readers to skip the focus for hidden elements


function toggle_height(element) {
       let li_elem = element.closest("li.awesome-accordion-item");
       let ac_elem = li_elem.find(".awesome-accordion-panel");
       if (li_elem.hasClass("closed"))
       {
           ac_elem.css("max-height", "400px");
           li_elem.removeClass("closed");
           li_elem.find(".awesome-accordion-btn").attr("aria-expanded", "true");
           li_elem.find(".awesome-accordion-panel *").removeAttr("tabindex");
           $(".awesome-accordion-panel").attr("tabindex", 0);
       }
       else
       {
           ac_elem.css("max-height", 0);
           li_elem.addClass("closed");
           li_elem.removeClass("opened");
           li_elem.find(".awesome-accordion-btn").attr("aria-expanded", "false");
           li_elem.find(".awesome-accordion-panel *").attr("tabindex", -1);
           $(".awesome-accordion-panel").attr("tabindex",-1);
       }
   }

Ready to build better team pages?

Get it for $29.00

What's so awesome about us?

  • Open source

    Our plugins are 100% open source and developed transparently on Bitbucket. Anyone can join the development and contribute.

  • Works with your theme

    Our plugins are carefully crafted to keep your site fast, the html is easy to read and extend and we provide the option to disable js and css files from the settings page.

  • Well documented

    Our plugins are well documented with in our knowledge base. It’s a great way to find instant answers or read tutorials to almost every question!.

  • Excellent support

    All our plugins come with full support. We’re here to help and offer expert advice on how to get the most out of your plugin.

  • Money back garantee

    We have a very simple refund policy. We will try to fix issues first. If we can't, we will definitely give your money back.

  • Regular updates

    We are regularly working to improve the plugin by adding new features, fixing bugs and keeping updated with the latest WordPress version.

Back To Top