Tagged: Burger Menu, button, close
Hello, i am looking to see if there is a way to close the full screen overlay menu when someone clicks anywhere on the overlay to close. We would still want to have the burger menu button to also close, but would also want the ability to click anywhere on the overlay to close since some people don’t instinctively look for the X to close.
Hey Jason,
Thank you for the inquiry.
You can use this modified avia.js file or script to force the menu to close when you click anywhere in the overlay.
// https://pastebin.com/k2w3NXDd
We just added this block of code around line 1153:
$('body').click(function (e) {
if ($(e.target).is('.av-hamburger, av-burger-menu-main, av-burger-menu-main a')) return;
burger = $(this).find('.av-hamburger'),
animating = true;
if (burger.is(".is-active")) {
burger.removeClass("is-active");
htmlEL.removeClass("av-burger-overlay-active-delayed");
overlay.animate({ opacity: 0 }, function () {
overlay.css({ display: 'none' });
htmlEL.removeClass("av-burger-overlay-active");
animating = false;
});
}
});
Best regards,
Ismael