Forum Moderators: open
One way to approach this would be to write a small timeout script that would delay the hiding of the menu layer. This requires some dissection of the code you are using and some knowleldge of JavaScript.
Assuming that there is a function to hide the menu onmouseout, you could do something like setTimeout( "hideLayer(layerName)" , 1000);. This commands exectutes the function in the quotation marks after the time specified (in milliseconds).
The problem with off-the-shelf scripts are that they are difficult to customise, especially one's that hold the menu items in an array of some sort.
HTH
So I am thinking I can just use your timeout suggestion in that line? That would be great if it would work.
If you are using a fixed positioned menu you can grab the coordinates of the mouse and compare them to your menu(give each menu a left,right and bottom coordinate, based on their width and height) and hide/show accordingly.
Or if you make sure that your showMenu function also hides every other menu, you can combine that with the 'timeout' suggestion from above, and you will have something similar to a common windows menubar.
which is why I used the "onMouseOut" command to close the window. I could drop the "onMouseOut" command if I knew a way to close all other menus when I "mouseover" one of the other ones...
Well you have --> onmouseout="hideMenu(myMenu6);"
Now in your showMenu() function call your hideMenu() function with every menu except the one passed to the showMenu function.
...or if the mouse wasnt over any of the menus
The simplest way to hide the menus when the mouse isnt over them is to use that timeout method and give enough of a delay so that the user isnt still reading the menu, its not perfect but it will hide them.
Otherwise I think you have to determine the mouse coordinates and then detemine if the coordinates are 'above' one of your menus.
Hope that helps.
Well you have --> onmouseout="hideMenu(myMenu6);"Now in your showMenu() function call your hideMenu() function with every menu except the one passed to the showMenu function.
function showMenu(menuName){
// show menuName and hide others
setTimeout("hideMenu(menuName)",1000);
}
Just play around with the milliseconds parameter so it doesnt disappear too soon or too late.
You may need to include another function instead of your hidemenu on the onmouseout. Something like delayhidemenu:
function delayHideMenu(menuName) {
setTimeout("hideMenu(menuName)",1000);
}
So, now your onmouseout would look like: onmouseout="delayHideMenu(menu6)"
I've not tested this though!
<script>
function delayHideMenu(mozilla) {
setTimeout("hideMenu(mozilla)",1000);
}
</script>
<script>
function delayHideMenu(test) {
setTimeout("hideMenu(test)",1000);
}
</script>
<script>
function delayHideMenu(myMenu6) {
setTimeout("hideMenu(myMenu6)",1000);
}
</script>
<script>
loadMenus("mozilla","test","myMenu6");
</script>
<font face="Helvetica, Arial, sans-serif">
<a href="javascript://" onmouseover="showMenu(mozilla,30,40),hideMenu(test),hideMenu(myMenu6);"
onmouseout="delayHideMenu(mozilla)"> mozilla</a>
<a href="javascript://" onmouseover="showMenu(myMenu6,10,40),hideMenu(test),hideMenu(mozilla);"
onmouseout="delayHideMenu(myMenu6)"> myMenu6</a>
<a href="javascript://" onmouseover="showMenu(test,20,40),hideMenu(mozilla),hideMenu(myMenu6);"
onmouseout="delayHideMenu(test)"> test</a>
</font>
With this code, the delay will work for the first mouseover for myMenu6. After that, the menu will disappear immediately. The other menus will stay up until I move the mouse over another menu. Thanks for your help!
Then, in your html, your onmouseout would now look like onmouseout="delayHideMenu('TheMenuInQuestion')".
Also, in your onmouseover, seperate your function calls with a ';', and not a comma.