FORUMS: list search recent posts

Advanced JavaScipt inquiry: Recognizing when the onMouseOver is active

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Marco Solorio
Advanced JavaScipt inquiry: Recognizing when the onMouseOver is active
on Aug 10, 2005 at 9:45:55 pm

Hi all. I've searched the net and the Cow Web forum with no results. Here's the scenario...

I have a main menu with buttons. When rolling over the main buttons, a drop down menu appears. When I roll out of the main menu button, the script times out for a second and then does whatever you want to do next, i.e., make the drop down menu disappear. However, when you go over the drop down menu, it disappears since it's off the main menu button.

I need a ONE LINE code of script to solve my problem. When the time out script times out, I want the computer to see if the onMouseOver function is still active on either the main menu button or the dropdown menu. I need a simple code, something like this...

     if (document.getElementByID("menu"+i).onMouseOver) {
dosomething
}


The above script doesn't work, but I have to imagine I'm not far off and that there is a line of code that does work for what I need. Any creative answers out there?

Thanks!

Marco Solorio  |  OneRiver Media


Return to posts index

Curtis Thompson
Re: Advanced JavaScipt inquiry: Recognizing when the onMouseOver is active
on Aug 10, 2005 at 9:53:34 pm

hey marco...

the easiest way i've always done this is to just use a flag for the menu status - so if you have 4 menus with dropdowns, make an array of 4 elements and set them all to false - then with each menu mouseover, you'd have logic like this (let's call the array of statuses "array_stat" and assume we're talking about the first menu item):

1. on mouseover main menu button: array_stat[0] = true
2. on mouseout main menu button: sleep for 200 then array_stat[0] = false
3. onmouseover sub menu: array_stat[0] = true
4. on mouseout sub menu: array_stat[0] = false

then for #2, you call the referenced function to sleep for a few hundred milliseconds - then it can run the test on array_stat[0] to see what it currently is. if it's not true, then hide the menu; otherwise, leave the menu showing. that way, when you mouseout of the menu button, it will have time to get the mouse over the sub menu, which will reset the array_stat[0] status back to true, which will then make sure it stays open when the mouse is over the sub menu - then the mouse out of anywhere will wait the milliseconds and hide it - a few hundred or so is enough to cover the mouse movement from button to menu but also not be visibly noticable when you mouse out completely...

make sense?

sitruc


Return to posts index

Marco Solorio
Re: Advanced JavaScipt inquiry: Recognizing when the onMouseOver is active
on Aug 10, 2005 at 11:31:39 pm

Hey Curtis!

I tried flagging it too, but I didn't do it by means of an array. Hmmmm, this looks good! And yes, it makes sense. I'll give it a go and see if it works. Thanks for the help. You always have the answers!!! I'll come back if I'm stuck.

Thanks,

Marco Solorio  |  OneRiver Media


Return to posts index


Marco Solorio
Re: Advanced JavaScipt inquiry: Recognizing when the onMouseOver is active
on Aug 11, 2005 at 2:20:27 am

Hey it works! I was close before with using the flag idea, but I was off by just a little bit. Glad I asked though because then it forced me to figure it out with your help. You always pull through, Curtis!

Hey when are you coming down to the 'Creek again? We need to have another sushi run.

Thanks again,

Marco Solorio  |  OneRiver Media


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]