jasonsyourhuckleberry
11/19/2018 - 7:17 PM

Divi fullscreen custom menu click-to-close code

Use this JS when creating a custom fullscreen Divi menu overlay with a layout from the Divi library and custom stacked menu items. Put in a doc.ready and pull the Divi layout in header.php and yer good to go.

// This is the click event to make the main menu overlay hide on click
    $(".et_slide_in_menu_container, .nav-menu-item, .et_header_style_fullscreen .et_slide_in_menu_container span.mobile_menu_bar.et_toggle_fullscreen_menu").on('click', function(e) {
        $(".et_slide_in_menu_container").toggleClass("et_pb_fullscreen_menu_opened");
    });
<div class="et_pb_fullscreen_nav_container">
	<?php echo do_shortcode('[et_pb_section global_module="divi-library-mod#-here"][/et_pb_section]'); ?>
</div>