How to Change Divi’s Toggle/Accordion Module Animation Speed

We love Divi around here, obviously, we were one of the first 3rd party developers to release products for Divi back in 2015. However, just like your friends & family who you love, Divi can annoy the crap out of you from time to time. Over the years, we’ve collected a library of “fixes” we hope to release as tutorials from time to time, that’ll hopefully lessen your frustration.

First up, what’s with the annoying speed at which toggles & accordions open and close? Personally, I’ve never liked the look of how they transition from closed to open and vice versa.

Divi's toggle animation speed is so slow

Like most things, you can find help, workarounds & fixes by searching one of the million helpful Divi Facebook Groups out there, but this one was a bit tough to find a solution for, so we wanted to show you how to Change Divi’s toggle/accordion module animation speed in 3 simple steps! Special thanks to Brant Barton, our resident expert Developer for the solution!

Step 1: Install a Child Theme (if you don’t have one installed already). Child themes are essential, in our opinion, but the main reason we recommend you use one is to protect your customizations from being overwritten any time Elegant Themes releases an update for Divi. If you don’t know what a child theme is, check out our post here for the deets. And if you need a Child Theme, you can download one for free there as well!

Step 2: Click here to download and unzip this folder (“js”). Add the entire folder to your main child theme folder.

Step 3: Open up your functions.php file and add the line in bold below underneath the line that’s enqueueing your main stylesheet:

add_action( “wp_enqueue_scripts”, “bsf_get_assets” );

function bsf_get_assets() {
wp_enqueue_script( “custom-js”, get_stylesheet_directory_uri().”/js/custom.js”, array(“divi-custom-script”, “jquery”), “1.0.0”, true );

Try as we might, we can’t get the quotes in the script above to be non-fancy quotes. Please make sure to use plain text quotes.

What you’re doing in Step 3 is telling Divi to override the default functionality of whatever scripts that are in the custom.js file. This is also a great place to add any other js tweaks or functionality you may wish to add to your site in the future.

That’s it! Your toggles should now open much more rapidly.

Changing Div's toggle animation speed can be done

  • drew naylor
    May 21, 2021

    It’s too bad this isn’t working. I followed the steps to the letter and when I change the funcions.php file my site goes down and I have to revert the file back. I feel like I know what I’m doing with the child theme setup, so I’m not sure what the issue is. I believe it may have to do with the fact that the only function at the top of my php file is not the same name. It is “function my_theme_enqueue_styles()” so maybe that is the problem?

    • Brant Barton
      May 26, 2021

      Thanks for your comment. The code above has been updated!

  • Linda Mattson
    June 12, 2021

    I was extremely happy to have found your solution. I have a client with multiple toggles on multiple pages. When the toggles on his website were closed the background was dark blue. When the toggles are open the background turns to white. Before implementing your solution the blue background stayed blue during the transition of the toggle from closed to open. Now with your logic in place, the toggle opens instantly and no more distracting blue background during toggle open. My clients website is

  • k3rnal_pan1c
    July 23, 2021

    OMG! Thank you! I’ve hacked it all sorts of ways, but this was the most elegant.

  • Andri
    November 5, 2021

    Not working on divi Version: 4.13.0

    • Andri
      November 5, 2021

      its working!

      • Nathan Duvall
        November 5, 2021

        Awesome, glad you worked it out, Andri! Cheers!


Talk It Out.

Leave A Comment