How to add a collapsible mobile menu in Divi.


Sep 28, 2021 | Divi Tips | 0 comments

A collapsible mobile menu in Divi is something you might think would be standard or at least an option, but is not. The good news is it’s easy enough to pull off.

How to add a collapsible mobile menu in Divi

In your Appearance / Menu area click the “Screen Options” button in the upper right. Make sure CSS Classes is checked.

Click the down arrow next to the menu items that have sub-menus. Add “first-level” to the CSS Classes field.

Next, add “second-level” to each sub-menu item class.

Note: This works on a second level or one sub menu deep only. Multiple sub menu items would need more coding.

TIP: The top level link sometimes does not work. I typically add the top level link as a sub-menu item but hidden on desktop (by using this method).

Save Menu.

Add this to the Divi theme options / Integration / Head area inside of a <script> tag.

// collapsible mobile menu
(function($) {       
function setup_collapsible_submenus() {     
var FirstLevel = $('.et_mobile_menu .first-level > a');'click').click(function() {
$(this).attr('href', '#');  
$(window).load(function() {
setTimeout(function() {
}, 700);

Add the following CSS to the Divi Options / Custom CSS (without style tags) or Integration / Head area (use style tags).

/* collapsible mobile menu BEGIN */
.et_mobile_menu .first-level > a {
background-color: transparent;
position: relative;
.et_mobile_menu .first-level > a:after {
font-family: 'ETmodules';
content: '\4c';
font-weight: normal;
position: absolute;
font-size: 16px;
top: 13px;
right: 10px;
.et_mobile_menu .first-level > .icon-switch:after{
content: '\4d';
.second-level {
display: none;
.reveal-items {
display: block;
/* collapsible mobile menu END */

That’s all! Please comments below.


Submit a Comment

Your email address will not be published. Required fields are marked *

More Tips

Ad - Web Hosting from SiteGround - Crafted for easy site management. Click to learn more.

Cloudways Hosting

WPEngine Hosting

Pressable Hosting

AccuWeb Hosting

Ask the Divi Guy a Question

"*" indicates required fields