admin管理员组文章数量:1323335
I am trying to show an anchor link when a div is hovered. This is working fine, but when I hover over the link itself, it flashes, when it should just stay. I tried a regular hover function on the anchor link and that didn't work... This is my js:
$('.div_mayKnowUser').live("mouseover", function(){ $(this).find('.a_ignoreUser').fadeIn(); }); $('.div_mayKnowUser').live("mouseout", function(){ $(this).find('.a_ignoreUser').fadeOut(); });
and my HTML:
<div class="div_mayKnowUser">
<a href="" class="a_ignoreUser">a link</a>
</div>
I am trying to show an anchor link when a div is hovered. This is working fine, but when I hover over the link itself, it flashes, when it should just stay. I tried a regular hover function on the anchor link and that didn't work... This is my js:
$('.div_mayKnowUser').live("mouseover", function(){ $(this).find('.a_ignoreUser').fadeIn(); }); $('.div_mayKnowUser').live("mouseout", function(){ $(this).find('.a_ignoreUser').fadeOut(); });
and my HTML:
<div class="div_mayKnowUser">
<a href="" class="a_ignoreUser">a link</a>
</div>
Share
edited Dec 7, 2022 at 19:21
Brian Tompsett - 汤莱恩
5,89372 gold badges61 silver badges133 bronze badges
asked Jun 13, 2011 at 21:30
webwrkswebwrks
11.9k5 gold badges26 silver badges21 bronze badges
1
- you should use Delegate, chain your jQuery methods and search not by class only, but by Tag name as well. – vsync Commented Jun 13, 2011 at 21:36
1 Answer
Reset to default 9"mouseover" => "mouseenter"
"mouseout" => "mouseleave"
worth a read => http://www.quirksmode/js/events_mouse.html
Edit: regarding live and mouseenter/mouseleave, it seems there's a known bug that hasn't been fixed, see the examples on the ments.
本文标签: javascriptLive mouseover eventStack Overflow
版权声明:本文标题:javascript - Live mouseover event - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742137827a2422447.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论