Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add class to each sub-nav in Divi for separate styling. (add this code to Divi > Theme Options > Integrations > Body scripts. This will add a class to each individual sub nav (ie "sub-nav-1", "sub-nav-2" and so on). These new classes can now be styled individually to target the border-color, or anything else you want.
<script type="text/javascript">
jQuery(document).ready(function($) {
$( ".menu-item-has-children .sub-menu" ).addClass(function( index ) {
return "sub-nav-" + index;
.nav li ul.sub-menu-1,
.nav li ul.sub-menu-4 {border-color: red;}
.nav li ul.sub-menu-2,
.nav li ul.sub-menu-5 {border-color: blue;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.