Unverified

Name

Close The Divi Default Mobile Menu By Clicking Outside The Dropdown

About

Close The Divi Default Mobile Menu By Clicking Outside The Dropdown

Language

Javascript

Rating

Voted: 1 by 1 user(s)

How to Setup Snippet

If you are using our free Divi child theme, place this snippet into the scripts.js file and remove the <script> tags at the beginning and end. Otherwise, place this in your Divi>Theme Options>Integrations tab in the “Add code to the < head > of your blog” code area OR You can use code snippet Pro. Remember: you will need <script> </script> if you are not using code snippet and inserting directly into the code.

Codevault

ONEMCO

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Website/ Profile URL:

https://onemco.com

Snippet Source:

https://onemco.com/forum/d/57-how-to-close-the-divi-mobile-menu-by-clicking-outside-the-dropdown

History

Last modified:

01/08/2023

Important Note

This snippet has the following status:

Unverified

This snippet has not been verified, use with caution and at your own risk. See details provided by author in sidebar and click below to find out more.

Close The Divi Default Mobile Menu By Clicking Outside The Dropdown

 
                    
1jQuery(document).ready(function(){
2jQuery("body").on("click", function(event){
3var clickedElement = jQuery(event.target);
4if(clickedElement.closest('.mobile_nav').length > 0){
5return;
6}
7if(jQuery(".mobile_nav").hasClass("opened")){
8jQuery(".mobile_menu_bar").click();
9}
10})
11})

1

Related Snippets

Please see some snippets below related to this snippet..

JavaScript

Unverified

0

Divi Accordion Close by Defaulty

Added: 9 months ago

Last Updated: 9 months ago

Sets all tabs in the divi accordion to close by default

JavaScript

Unverified

0

Activate Post Comments BuddyBoss

Added: 1 year ago

Last Updated: 1 year ago

Comments on blogposts outside of buddyboss cannot be posted, because a hidden field forbids the abesenden of the comment.

JavaScript

Unverified

0

Autoplay Videos

Added: 9 months ago

Last Updated: 9 months ago

Use with Divi Builder when adding a video to a page with the vido module

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WordPress Admin

AI Verified

1

Hide WP Admin Bar For Non-Admins

Added: 1 year ago

Last Updated: 1 year ago

Hide WP Admin Bar For Non-Admins

General

AI Verified

1

Disable Login Screen Language Switcher

Added: 1 year ago

Last Updated: 1 year ago

Disable Login Screen Language Switcher

JavaScript

Unverified

1

Close The Divi Default Mobile Menu By Clicking Outside The Dropdown

Added: 1 year ago

Last Updated: 1 year ago

Close The Divi Default Mobile Menu By Clicking Outside The Dropdown