Jquery:排除包含的元素
Chouette
我想将鼠标悬停在 div 上而不是 img
$('div').mouseover(go_truc);
我该怎么做?
Chouette
I'd like to mouseoverize the div but not the img
$('div').mouseover(go_truc);
How can I do that ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
处理
mouseenter
事件,但if ($(e.target).is('img'))
不执行任何操作。然后,处理
元素的
mouseenter
事件,并撤消效果。Handle the
mouseenter
event, but do nothingif ($(e.target).is('img'))
.Then, handle the
<img>
element'smouseenter
event, and undo the effect.它
可以工作,但它是最简单/最好的解决方案吗?
(无论如何,我需要处理 img.mouseover 用于其他目的)
With
It's working, but is it the simplest/best solution ?
(Anyway I need to handle the img.mouseover for other purpose)