Make Divi Accordions Closed by default

To do so, add the following JavaScript codes via Divi > Theme Options > Integrations > Head Code

<script>
jQuery(function($){
    $('.et_pb_accordion .et_pb_toggle_open').addClass('et_pb_toggle_close').removeClass('et_pb_toggle_open');
    $('.et_pb_accordion .et_pb_toggle').click(function() {
      $this = $(this);
      setTimeout(function(){
         $this.closest('.et_pb_accordion').removeClass('et_pb_accordion_toggling');
      },700);
    });
});
</script>

5 thoughts on “Make Divi Accordions Closed by default”

  1. Works fine, but if you open a “piece” of the accordion, it will stay permanently open. Anything we can add to the code to get back the closing functionality?

  2. Just wanted to say thanks for the code snippet, it does what I wanted it to do. Not really interested in closing it as well. Just having a compact list that users can choose from. This was perfect. Thanks.

Leave a Reply