onpageClick to close Menu Box

Hi,

I have a menu that pops up when you click on the profile of a person. I want it to close when I click anywhere else on the page. I’ve tried using mouseOut but it’s not 100% the desired effect.

Something like:

$(document).click(function(e) {
   $('#box140').hide();
});

But more Wix’y.

Any suggestions?

Many thanks

Thomas

You can set an onClick for the page, let’s say it’s called ‘page1’, and the menu is bounded by a box called ‘myMenu’.
Set the on click:

Code will be:

export function page1_click(event, $w) {
	$w('#menu').hide();
}

Liran.

Perfect, works great. The only issue is that the cursor now changes to a little hand as it thinks it can click everything on the page. Is there a way around this?

Thomas

Unfortunately not…
But here’s another thought…
How about putting a transparent box over the screen, between the page and the menu you mentioned,
And just show it when the menu opens (a click on profile), and set it to hide when it gets clicked?

Liran.