On Jan 5, 2007, at 17:30 , Fabien Meghazi wrote:

> I'm trying to have a div displayed over the link when we click on it.
> When we mouse over the displayed div, I want it to disapear.
> My problem is that in the div I have many elements and some links.
> When the mouse come over a link, the mouseout event of the parent div
> is triggered.
> I want to avoid that. How can I do ?
>
> PS: Already tried stopPropagation()

There are two directions from which to approach this problem. One is  
to cause the child elements to stop event propagation, as you have  
been discussing. Sometimes, though, it might be more convenient to  
alter the parent handler with an extra test instead of putting the  
safeguard in the child elements. In addition to  
fixing .stopPropagation() so that it is cross-browser, jQuery makes  
the .target attribute available regardless of platform. So you might  
write

$('#foo').mouseout(function(e) {
   if (this == e.target) {
     // do your magic
   }
}

In essence, check that the item being moused out of is in fact the  
item that the handler is attached to.

--
Jonathan Chaffer
Technology Officer, Structure Interactive
(616) 364-7423    http://www.structureinteractive.com/




_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to