How do I ignore mouse events on child elements in jQuery?

前端 未结 5 1197
独厮守ぢ
独厮守ぢ 2020-12-08 10:38

I have an unordered list with mouseover and mouseout events attached to the li elements. Each contains a link and there is a bit of padding in the li. When I mouseover the l

5条回答
  •  没有蜡笔的小新
    2020-12-08 11:09

    I was looking for the equivelant behavior in JS where in AS3 you can put:

    object.mouseenabled = false;
    

    The way I found that works pretty well is to use CSS and put:

    .element { pointer-events: none; }
    

    (but I guess that only works if you don't need the element for anything at all. I use it for tooltips that pop up on hover, but don't want it to act weird when you move your mouse away).

提交回复
热议问题