Daniel N wrote:
> Hi,
>
> ...
> It seems that the mouse* events are fired for every sub element
> contained in the list item, but the actual list item itself may or may
> not fire an event at all. With all these events firing for mouseover
> and mouseout when the mouse is still completely within the list item,
> it really doesn't go very well.
>
> Is the the wrong way to approach this? Is there anywhere where I
> could go to get some information on an appropriate way to handle this?
>
This is a use case for mouseenter and mouseleave. I submitted a patch
for it; it is scheduled to be part of Prototype 1.6. (see
http://dev.rubyonrails.org/ticket/8354)
Without the patch, you can add the code below to the beginning of your
mouseover and mouseout functions so that mousing over and out of child
elements has no effect.
--Ken Snyder
onMouseOver: function(event) {
var currentTarget = this.container;
var relatedTarget = $(event.relatedTarget || event.fromElement);
if (relatedTarget==currentTarget ||
relatedTarget.childOf(currentTarget)) return;
...
},
onMouseOut: function(event) {
var currentTarget = this.container;
var relatedTarget = $(event.relatedTarget || event.toElement);
if (relatedTarget==currentTarget ||
relatedTarget.childOf(currentTarget)) return;
...
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---