forked from zaclys/searxng
46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
var isHidenUL = true;
|
|
|
|
function toggleMobileMenu(event) {
|
|
event.stopPropagation();
|
|
|
|
let hidenUL = document.querySelector('#mobile_menu');
|
|
|
|
/* console.log('click event => toggleMobileMenu called');
|
|
console.log(hidenUL) */
|
|
|
|
if (hidenUL && isHidenUL) {
|
|
hidenUL.style.display = 'block';
|
|
isHidenUL = false;
|
|
} else if (hidenUL && !isHidenUL) {
|
|
hidenUL.style.display = 'none';
|
|
isHidenUL = true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
function hideMobileMenu(event) {
|
|
|
|
let hidenUL = document.querySelector('#mobile_menu');
|
|
|
|
/* console.log('click event => toggleMobileMenu called')
|
|
console.log(hidenUL) */
|
|
|
|
|
|
if (hidenUL && !isHidenUL) {
|
|
hidenUL.style.display = 'none';
|
|
isHidenUL = true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
let elEvent = document.querySelector('#et_mobile_nav_menu');
|
|
|
|
console.log(elEvent)
|
|
|
|
if (elEvent) {
|
|
document.querySelector('#mobile_menu').style.display = 'none';
|
|
elEvent.addEventListener("click", toggleMobileMenu);
|
|
document.querySelector("body").addEventListener("click", hideMobileMenu);
|
|
} |