2
I use a plugin jQuery
which generates a hidden side menu and when clicking the button, the menu appears, shifting the content of the site to the side. The problem is that the site elements remain "clickable" and the menu does not close automatically if I click outside it.
With that, 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 clicked on any element within the div .wrapp
, closing the menu (id #sidr
) and overriding the possible alternative click.
Although the menu is closing right, I can still click on any link outside the menu.
Best explanation in the picture:
You can create a jsFiddle with an example?
– Sergio
Difficult, because the menu requires external scripts. But I will try to better exemplify with images.
– Ricardo