jquery鼠标悬停问题
我有一个 jquery 脚本,它会在 div 上的鼠标悬停时触发,如下所示:
<div class="myDiv">
<span class="mySpan">text text text</span>
</div>
问题是,当我将鼠标悬停在文本上时,它的行为就像鼠标悬停一样,但我不希望这样。我可以在上面放置一个不可见的 div 并触发其上的移动,但我想让它尽可能简单。
有什么建议吗...?
I have a jquery-script that triggers on mouseover on a div like this:
<div class="myDiv">
<span class="mySpan">text text text</span>
</div>
The problem is that it acts like mouseout when i hover over the text and I dont want that. I could put an invisible div over it all and trigger the moseover on that but I would like to keep it as simple as possible.
Any suggestions...?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在寻找 mouseleave / mouseenter 不是 mouseout/mouseover
mouseleave 在离开父级时触发,而 mouseout 在子级上触发
You are looking for mouseleave / mouseenter not mouseout/mouseover
mouseleave fires when leaving the parent, while mouseout fires on children