jQuery: issues with mouseover event if the element has children

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-05-19T19:47:31Z Indexed on 2010/05/19 19:50 UTC
Read the original article Hit count: 162

Filed under:

hi,

I have the following element:

<div id="#block-block-1">
    <p>KAREN LANCEL:<br>
lancel(at)xs4all.nl<br>
phone 0031 (0)624873424</p>
<p>HERMEN MAAT:<br>
maat(at)xs4all.nl<br>
phone 0031 (0)628536885</p>
</div>

which is supposed to disappear when the mouse is moved out of it (I will ignore now to talk about the fading in event).

This is the code to make it fading out:

$('#block-block-1').mouseout(function() {
        $(this).css("display","none");
    });

The issue here is that the 'mouseout' event is triggered when the mouse is over the children

elements inside my div. And the parent disappears even if the mouse is still inside it.

© Stack Overflow or respective owner

Related posts about jQuery