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

Published on August 31, 2020

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.

old toggle speed

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.

new toggle speed
Shopping cart0
There are no products in the cart!
Continue shopping
0