How to disable mouseout events triggered by child elements?

后端 未结 9 1206
野的像风
野的像风 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:32

    The question is a bit old, but I ran into this the other day.

    The simplest way to do this with recent versions of jQuery is to use the mouseenter and mouseleave events rather than mouseover and mouseout.

    You can test the behavior quickly with:

    $(".myClass").on( {
       'mouseenter':function() { console.log("enter"); },
       'mouseleave':function() { console.log("leave"); }
    });
    

提交回复
热议问题