如果你看一下这个 fiddle :http://jsfiddle.net/5PH8p/
然后你可以看到,如果你将鼠标悬停在空白图像上,它会翻转并显示一些文本。 但问题是,当您将鼠标悬停在该段落上时,图像会翻转。
我的问题是,如何更改脚本,以便当鼠标悬停在图像上时它只会翻转图像,而不是段落上。
我想将该段落保留在 HTML 结构中,就像现在这样
`<div class="thumb scroll">
<p>
<strong>John Doe</strong><br>
CEO & Partner<br>
<a href="mailto: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3f5550517f5b505a115b54" rel="noreferrer noopener nofollow">[email protected]</a>"><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="93f9fcfdd3f7fcf6bdf7f8" rel="noreferrer noopener nofollow">[email protected]</a></a></p>
<div class="thumb-wrapper">`
希望我说得足够清楚,提前谢谢。
最佳答案
您可以使用e.stopPropagation()防止事件在 DOM 树中冒泡:
$('.thumb p').mouseover(function(e) {
e.stopPropagation();
});
关于jQuery 缓动 - 悬停时翻转图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21759031/