1// jQuery
2$(window).click(function() {
3//Hide the menus if visible
4});
5
6// JavaScript
7const getBody = document.querySelector('body');
8getBody.addEventListener('click', () => {
9 //Hide the Menus if Visible
10});
11
12// Stop Propogation on Element you want to hide
13$('#menucontainer').click(function(event){
14 event.stopPropagation();
15});
16
17// Example
18menu.addEventListener('click', (event) => {
19 event.stopPropagation();
20 // Open Menu
21});