How to disable mouseout events triggered by child elements?

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

    I agree with Ryan.

    Your problem is that the "next" div is not a "child" of A. There's no way for HTML or jQuery to know that your "a" element is related to the child div in the DOM. Wrapping them and putting a hover on the wrapper means that they are associated.

    Please note that his code isn't in line with best practices, though. Don't set the hidden style inline on the elements; if the user has CSS but not javascript, the element will hide and will not be able to be shown. Better practice is to put that declaration in the document.ready event.

提交回复
热议问题