how to modify the below code so that not only a click outside the menu, but also scrolling down, will trigger closing the menu?
var closeDelay = 50;
(function($) {
$(window).load(function() {
setTimeout(function() {
$('#main-content, .et-l--footer, .et_menu_container a').each(function() {
$(this).click(function() {
setTimeout(function() {
if ($('.et_mobile_menu').is(':visible')) {
$('.mobile_menu_bar_toggle').trigger('click');}
}, closeDelay);
});
});
}, 1200);
});
})(jQuery);
It's currently live @ semita.pl.
Thanks!