[英]Handler for hovering over an element and all its children
The handler must operate when you hover over an element with a class D1 and when you hover over all his children. 当您将鼠标悬停在具有D1类的元素上并且将鼠标悬停在其所有子元素上时,处理程序必须进行操作。 How to do it?
怎么做? Tried through the cycle but confused.
尝试了整个周期,但感到困惑。
<div class="d1">
<h2>Lorem Ipsum</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Expedita inventore nobis cum itaque unde eos aliquam labore reiciendis iusto dolore ducimus tempore quidem et nisi debitis similique ea dignissimos ex.</p>
</div>
You can use mouseenter
and mouseleave
instead of mouseover
and mouseout
. 您可以使用
mouseenter
和mouseleave
代替mouseover
和mouseout
。 These have the functionality you need, provided you're targeting the supported browsers (see links above). 如果您要定位受支持的浏览器(请参见上面的链接),它们将具有所需的功能。
Here's a working jsFiddle from your code: http://jsfiddle.net/rgthree/rs6qm9v5/2/ 这是您代码中的有效jsFiddle: http : //jsfiddle.net/rgthree/rs6qm9v5/2/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.