<div class='someclass'>Text</div>
<div class='otherclass'>Other Text</div>
<style>
.someclass{
width:400px;
height:200px;
}
.otherclass{
width:400px;
height:200px;
display:none;
}
</style>
$('.someclass').mouseover(function(){
$('.otherclass').fadeIn();
});
$('.someclass).mouseout(function(){
$('.otherclass').fadeOut();
});
,但我不想第二个div淡出如果光标越过这第二个div。
我可以使用
$('.someclass,.otherclass').mouseover(function(){
$('.otherclass').fadeIn();
});
$('.someclass,.otherclass').mouseout(function(){
$('.otherclass').fadeOut();
});
但它闪烁通过跨越从一个DIV到另一个。
我想,我可以使用超时,但有没有更好的方法?谢谢!
已解决。 我刚刚使用mouseleave而不是mouseout。它适用于位置:如果嵌套,则为绝对。 – Sobakinet 2012-03-14 19:23:32