How to disable mouseout events triggered by child elements?

后端 未结 9 1207
野的像风
野的像风 2020-11-30 21:09

Let me describe the problem in details:

I want to show an absolute positioned div when hovering over an element. That\'s really simple with jQuery and works just fin

9条回答
  •  星月不相逢
    2020-11-30 21:46

    For simplicity sake, I would just reorganize the html a bit to put the newly displayed content inside the element that the mouseover event is bound to:

    Hover Me
    Test

    Then, you could do something like this:

    $('#hoverable').hover( function() { $(this).find("div").show(); },
                           function() { $(this).find("div").hide(); } );
    

    Note: I don't recommend inline css, but it was done to make the example easier to digest.

提交回复
热议问题