I use a jQuery
plugin that generates a hidden side menu, and by clicking the button, the menu pops up, shifting the site content sideways. The problem is that site elements remain "clickable" and the menu does not close automatically if I click outside it.
With this, I created the script below:
$('.wrapp').on('click', function(){
if ( ($('#sidr').is(':visible')) ) {
$(this).click(false);
$.sidr('close', 'sidr');
}
});
At first, it should run when you click on any element within div .wrapp
, closing the menu (id #sidr
) and overriding the possible alternate click.
Although the menu is closing properly, I can still click on any link outside the menu.
Better explanation in the image: