Interresting !
In fact I have developped a very complicated Contextual Menu, with
multiple <ul><li>.
Because of this strange behavior, on mouseout, I set a timeout before
closing the menu.
Then if the mouse movein quickly the menu stay opened like an OS Menu.
There is one issue with your solution, you might have to check if
mouse is on a submenu (sub UL/LI) ?
On 5/11/07, David Dashifen Kees <[EMAIL PROTECTED]> wrote:
>
> Well done. I hadn't thought of that. Thanks for sharing!
> - Dash -
>
> 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
> >
> >
> > >
> >
> >
>
> >
>
--
Jean-Philippe Encausse - R&D Jalios SA
Jp [at] encausse.net - http://www.encausse.com - http://www.jalias.com
GTalk: jp.encausse [at] gmail.com - SMS: sms [at] jp.encausse.net
Mob: +33 6 82 12 56 99 Jalios: +33 1 39 23 92 83 Tel: +33 1 39 18 90 15
Do it Once, Use it Twice ~ Do it Twice, Make It Once
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---