Force fake onmouseover

  • Thread starter news.west.cox.net
  • Start date
N

news.west.cox.net

I have been writing a practice sliding div navigation script. I am finding
myself in the position where I need to force a div into showing the hover
behavior defined in css.

So my question is this. If I have two divs, is there a way to make the
second div display its onmouseover behavior when the mouse is over div 1?
 
M

Mick White

news.west.cox.net said:
I have been writing a practice sliding div navigation script. I am finding
myself in the position where I need to force a div into showing the hover
behavior defined in css.

So my question is this. If I have two divs, is there a way to make the
second div display its onmouseover behavior when the mouse is over div 1?
onload=function(){ div1.onmouseover=function(){//do stuff with div2}}

or <a... onmouseover="afunction();anotherfunction();">

Mick
 
N

news.west.cox.net

Mick White said:
onload=function(){ div1.onmouseover=function(){//do stuff with div2}}

or <a... onmouseover="afunction();anotherfunction();">

Mick

I understand what you are saying here. But, it is not what I am looking
for. Let me try to explain better.

The navigation that I have written uses divs that slide into view when you
do a rollover on the main navigation bar. So, say someone rolled over the
first menu item, a div would roll out that shows some sub menu items for
that main menu item. The div stays visible until you rollout from the main
menu item or the sub menu. That all works great.

I have normal css applied to the main menu, so when you roll over an item
and the sub menu div rolls out, the link appearance changes because there is
"hover" behavior defined in my css file. When I move my cursor onto the sub
menu div, the "hover" behavior on the main menu item ceases. That is
because I am no longer hovering over it.

What I am looking for is a script to use for the onmouseover event for the
sliding div. So, when someone is hovering over the div, the main menu item
displays the hover state as defined by css.

Does any of this make sense??? I will try to put together a working example.

Ideally, I would be able to define a var that was say

----- pseudo code - not tested -----
var sm = document.getElementByID("SubMenuItem");
var mm = document.getElementByID("MainMenuItem");
if (sm.onmouseover == true) {
mm.onmouseover = true;
}

So that I could get the "hover" state to appear for MainMenuItem while the
mouse is over SubMenuItem.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top