Connecting Tech Pros Worldwide Forums | Help | Site Map

function is firing with every move of the mouse in the onmouseOver area

Newbie
 
Join Date: Mar 2007
Posts: 6
#1: Mar 14 '07
First off, I've pretty much convinced myself that the issue is that there are onmouseover events inside the div that contains an onmouseover event on it... I wrote the message below first. This was added as I sent.

Original:

My function is firing with every move of the mouse in the onmouseOver area.

I've assigned the onmouseOver event to a div tag. The function will expand the div downwards, over the other content on the page.

When I move the mouse into the mouseover area and stop moving it completely, the functions starts the animation no problem, but if I move the mouse even a pixil, the event fires all over again.

Some specifics:
- there is a nested div
- what I think may be the "gotcha", there is a set of rollover images for a nav within that nested div, that are display: none until the mouseover event fires the animation.
- the onmouseover event calls a function that initializes two functions for me, one changes some CSS values, the other fires the animation.

I am using the slider script from firblitz.com.

I've tried several different methods, and also wrote my own script, nothing would make that behavior go away. It's the same in FF and IE6.

Is there some way that I can truly detect if the mouse has moved away from the containing div?

Thanks,

Andy

Newbie
 
Join Date: Mar 2007
Posts: 6
#2: Mar 14 '07

re: function is firing with every move of the mouse in the onmouseOver area


Here's a thought, maybe I could pass a boolean to the function from the nested onmouseover, so if the main function knows that startAnim is false, quit, if it's true, start the animation.

That may only confuse the browser more as well though... It will then be getting start and stop commands continuously...

Hey, I could check it on the main function, if the nested div's display is set to block, then don't run, if it's none, run. That's too simple, that's why I didn't think of it before... :)

Anyway, I'm new here and look forward to jumping in.

- Andy


Quote:

Originally Posted by Sabbaath

First off, I've pretty much convinced myself that the issue is that there are onmouseover events inside the div that contains an onmouseover event on it... I wrote the message below first. This was added as I sent.

Original:

My function is firing with every move of the mouse in the onmouseOver area.

I've assigned the onmouseOver event to a div tag. The function will expand the div downwards, over the other content on the page.

When I move the mouse into the mouseover area and stop moving it completely, the functions starts the animation no problem, but if I move the mouse even a pixil, the event fires all over again.

Some specifics:
- there is a nested div
- what I think may be the "gotcha", there is a set of rollover images for a nav within that nested div, that are display: none until the mouseover event fires the animation.
- the onmouseover event calls a function that initializes two functions for me, one changes some CSS values, the other fires the animation.

I am using the slider script from firblitz.com.

I've tried several different methods, and also wrote my own script, nothing would make that behavior go away. It's the same in FF and IE6.

Is there some way that I can truly detect if the mouse has moved away from the containing div?

Thanks,

Andy

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#3: Mar 14 '07

re: function is firing with every move of the mouse in the onmouseOver area


Welcome to TSDN.

In the W3C model, you call e.stopPropagation() and in the Microsoft model, window.event.cancelBubble=true. See event order link. It might be useful to read the tutorial from the beginning.
Newbie
 
Join Date: Mar 2007
Posts: 6
#4: Mar 14 '07

re: function is firing with every move of the mouse in the onmouseOver area


Quote:

Originally Posted by acoder

Welcome to TSDN.

In the W3C model, you call e.stopPropagation() and in the Microsoft model, window.event.cancelBubble=true. See event order link. It might be useful to read the tutorial from the beginning.


Thanks! You totally rock.

- Andy
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#5: Mar 15 '07

re: function is firing with every move of the mouse in the onmouseOver area


No problem. You're welcome...
Newbie
 
Join Date: Mar 2007
Posts: 6
#6: Mar 15 '07

re: function is firing with every move of the mouse in the onmouseOver area


Quote:

Originally Posted by acoder

No problem. You're welcome...


I feel reeeaaally stupid... I don't have to worry about this at all. I can get rid of the nested rollovers by using a.hover and using a background-image: on it...

Doh! (smacks forehead)

- Andy
"Master of Missing the Obvious"
Reply