I realize this is a large script (compared to other help requests in this forum), but I thought I might ask anyway incase someone wanted to spend their afternoon looking over some Javascript
Here's the demo page: <removed>
Here's the script: <removed>
(Using
prototype and
script.aculo.us for slide up/down effect).
<For archival purposes, see attachment instead for JS>
It works well enough, but there are still a few bugs. One is, if you quickly mouse over several menus, some of them 'stick' (don't close). For example, put you mouse by the 'home' link and quickly move it all the way to the right. Instead of closing each menu when a new one opens, or closing them on document onmouseover, they stick.
The script keeps an internal record of what menus are open (osMenu.open_menus, right now only one menu is meant to be open at a time, but this if for future extension). After debugging, I found the array to be empty. So somehow they are going through the close routines... but not closing lol.
So if anyone has any ideas give me a shout
Edit
After much tinkering, I fixed it
The slide effects are animations and are thus are running at an interval. My close menu methods worked fine, but the running interval would re-set the states of the menus (making them re-appear in the correct position). The solution is to keep track of all active effects, and cancel them when closing them (if they aren't already finished). The Effect object created to make the slide effects has a cancel() method that will cancel the effect, and this is what I ended up using.