mouse In and Out event

I am a newbie to wix developer portal and trying to create a customised dropdown menu with onMouseIse and onMouseOut. It works absolutely fine for the first time but it doesn’t work if i hover again.

Had the same problem with submenu section and also for animations

Can someone please help. Below is the code

export function button7_mouseIn(event) {
$w( “#megabox” ).show();
}

export function button7_mouseOut(event) {
$w( “#megabox” ).collapse();
}

Either use .show() and .hide()
OR .expand() and .collapse().

But you can’t do it if you use .show() in the first function and .collapse() in the second one.