471,350 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Force fake onmouseover

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?
Jul 23 '05 #1
2 6376
news.west.cox.net wrote:
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
Jul 23 '05 #2

"Mick White" <mw***********@rochester.rr.com> wrote in message
news:uq****************@twister.nyroc.rr.com...
news.west.cox.net wrote:
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


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

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Charles Eubanks | last post: by
4 posts views Thread by laurie | last post: by
7 posts views Thread by Richard | last post: by
7 posts views Thread by windandwaves | last post: by
3 posts views Thread by drjackk | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.