I think this question has been asked before, but i tried a few suggested approaches but still cannot get it to work unfortunately, therefore asking again for myself more specifically.
I’m trying to have a dropdown box on the menu the pops out when you hover over it, and stays when you navigate onto the dropdown box. Right now, strangely, the popout box only works when i scroll very quickly into it. Example video below:
Here is the code that ive used for the site code and the home page code… It is the same for both. Do you see any errors or have any idea how to fix this? THANK YOU
export function Learnaboutbitcoin_mouseIn(event) {
$w( ‘#MegaMenu’ ).show();
}
export function Learnaboutbitcoin_mouseOut(event) {
$w( ‘#MegaMenu’ ).hide();
}
export function MegaMenu_mouseIn(event) {
$w( ‘#MegaMenu’ ).show();
}
export function MegaMenu_mouseOut(event) {
$w( ‘#MegaMenu’ ).hide();
}
Although you leave an element it does not close immediately, because it has a little time-delay, before the command is fired up to hide the leaved element.
Use —> setTimeout-command to achieve your aim and get a smoother/softer button action.
This code can only work, if there is NO SPACE between the elements!
export function Learnaboutbitcoin_mouseIn(event) {
$w('#MegaMenu').show();
}
export function Learnaboutbitcoin_mouseOut(event) {
$w('#MegaMenu').hide();
}
export function MegaMenu_mouseIn(event) {
$w('#MegaMenu').show();
}
export function MegaMenu_mouseOut(event) {
$w('#MegaMenu').hide();
}
@russian-dima
Yes that was correct logic.
Why should we hide if it come out from that place. ?
However we are hiding when user come out from mega menu.
Why we should hide twice for single element ?
Because, when user mouseout from top menu we no need to hide or make delay.
It will automatically close when user come out from that mega menu.
More over delaying cause the problem.
If we set 2 second delay. User will moveout immediately from the top menu. Them user still sees the mega menu which is bit annoying.
So that
Even if there is just 1-pixel of space between the main-menu and sub-menu in the first menu-example, it will immediatelly close the sub-menu. It will even close the menu immediatelly if there is absolutely no SPACE.
But the other 3 Menues have spaces between main and sub-menu.
If you deactivate the “hide-function”() you will get another issue.
Menu will NOT CLOSE UNTIL the SUBMENU had his MOUSE-IN-EVENT.
@russian-dima Hi I am having the same problem, there was no space between the 2 elements.
Mouse in button → the box opened
Mouse move to the box → it stays for a while then disappear when I move the mouse (still in the box)
If I move the mouse super slow, then the box can stay. Do you know what is the problem?