我有一个 div,其中有一个嵌套元素,当悬停在 div 上时会显示。这行得通。
在鼠标移出时,嵌套元素应该隐藏,它确实如此,但随后立即再次淡入,就好像我刚刚在初始 div 上执行了悬停一样。
我已经制作了一个 jsfiddle 来复制这里的问题。
html是:
<div class="add_bag_large_wrap">
<div class="add_bag_large_droid" style="margin: 90px auto;">
I am a button.
<div class="add_includes">
<p>Show on hover, hide on mouseout</p>
</div>
</div>
</p>
JS:
$('.add_bag_large_droid').live('hover',function(){
$(this).children('.add_includes').fadeIn();
}).mouseout(function(){
$('.add_includes').fadeOut();
});
CSS:
.add_bag_large_wrap {
position: relative;
width: 390px;
height: 96px;
margin: 36px auto;
}
.add_bag_large_droid {
background: #ccc;
width: 390px;
height: 96px;
cursor: pointer;
background-size: 390px 192px;
position: static;
}
.add_includes {
background: #000; padding: 18px; color: #fff; position: absolute;
bottom: 110px; left: 50%; margin-left: -148px;
display: none;
text-align: left;
}
.add_includes p {
font-size: 11px; color: #fff; margin: 0;
}
是什么导致了这种行为?