" ).insertBefore( ".et-db #et-boc .et-l .diviwp-header-14 .et_mobile_menu .menu-item-has-children > a" );
// remove the link for the parent menu item and apply reveal-items to the submenu
FirstLevel.off('click').click(function() {
// target the sub-menu and apply a toggle class of reveal-items
$(this).parent().children().toggleClass( 'reveal-items' );
// prevent browser jump to top when clicking the sub-menu toggle
return false;
});
// apply the same toggle to the inserted sub-menu-toggle
$( ".et-db #et-boc .et-l .diviwp-header-14 .et_mobile_menu .sub-menu-toggle" ).click(function () {
// target the sub-menu and apply a toggle class of reveal-items
$(this).parent().children().toggleClass( 'reveal-items' );
// prevent browser jump to top when clicking the sub-menu toggle
return false;
});
// prevent the menu from closing if any link is clicked $( ".et-db #et-boc .et-l .diviwp-header-14 .et_mobile_menu a" ).click(function () {
$( ".et-db #et-boc .et-l .diviwp-header-14 a.mobile_nav" ).removeClass( 'closed' ).addClass( 'opened noslide' );
});
// calculate starting height of sub-menu so that you can scroll the menu when the section is fixed or sticky
var totalheight = 0;
// target the mobile menu ul
jQuery( ".et-db #et-boc .et-l .diviwp-header-14 .et_mobile_nav_menu .mobile_nav .et_mobile_menu" ).each(function(){
// calculate the height of the ul section
totalheight = totalheight + jQuery(this).outerHeight();
});
// add px value to the totalheight variable
totalheight = totalheight + "px";
// add the total height variable to the mobile menu if the section has sticky scroll enabed via Section Settings -> Advanced -> Scroll Effects -> Stick to Top
jQuery(".et-db #et-boc .et-l .diviwp-header-14.et_pb_sticky_module .et_mobile_menu").css("max-height",totalheight);
} // end diviwp_header_14_setup_collapsible_submenus
$(window).load(function() {
setTimeout(function() {
diviwp_header_14_setup_collapsible_submenus();
}, 700);
}); // end window load
})(jQuery); // end function
// END DIVIWP COLLAPSIBLE SUBMENUS
});