Correct behavior.

You're seeing it because of event bubbling.  PPK explains this  
nicely, as well as providing a short cross-browser solution similar  
to Prototype's Event.element();
http://www.quirksmode.org/js/events_mouse.html

Checking mouse position like you're trying to do is the hard way.  =)


TAG

On May 11, 2007, at 6:40 AM, Sudara wrote:

>
> Hello.
>
> I spent an hour or three chasing down a desired effect that mootools
> implements, namely the simulation of onmouseleave and onmouseenter
> events.
>
> Why?
>
> Lets say you have a Menu. A ul element that contains many li elements.
> If you want to have a function (maybe an effect) fire when the mouse
> moves outside of the ul, you are out of luck. Observe the mouseout
> function like so:
>
> Event.observe(nav, 'mouseout', function(e) {
>       // you would think this would work
>       alert('mouse is outside of nav?...');
> });
>
> and what actually happens is that every time the mouse leaves the
> element OR crosses the boundary of a child element (li), the event is
> fired.
>
> Instead of implementing onmouseleave/onmouseenter the way that
> mootools has it, I saw that the sweet prototype API has a Pointer
> class.
>
> I'm still a bit green with Prototype, but my answer came in this
> shape:
>
> Event.observe(nav, 'mouseout', function(e) {
>       if(!Position.within(nav,Event.pointerX(e),Event.pointerY(e))){
>               alert('...mouse is now truly outside nav...');
>               });
>       }
> });
>
> Have a good day!
> Sudara
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to