考虑以下导航布局
主要导航
辅助导航
子导航(仅在翻转时显示) 主要或次要导航
我需要在fadeOut调用中延迟足够长的时间让用户将鼠标从主导航到子弹并且一旦越过subnav我需要悬停fadeOut取消。将鼠标悬停在辅助导航项上时重复该想法。 (我知道如何添加延迟但不知道如何取消悬停)
TIA
<div class="primary">
<ul class="primary common">
<li class="primary category" rel="politics">
<a href="#">POLITICS</a>
</li>
</ul>
</div>
<div class="secondary">
<ul class="secondary common">
<li class="secondary category" rel="news">
<a href="#">NEWS</a>
</li>
</ul>
</div>
<div style="display: block; height: 20px; width: 100px; overflow: hidden;">
<div id="politics" class="sub" style="display: none;">
<ul class="sub common">
<li class="sub">
<a href="#">POLITICS SUBNAV</a>
</li>
</ul>
</div>
<div id="news" class="sub" style="display: none;">
<ul class="sub common">
<li class="sub">
<a href="#">NEWS SUBNAV</a>
</li>
</ul>
</div>
</div>
$('.category').hover(
function() {
var subnav = $(this).attr('rel');
$('#' + subnav).fadeIn('slow');
}, function() {
var subnav = $(this).attr('rel');
$('#' + subnav).fadeOut('slow');
});
答案 0 :(得分:0)
尝试使用jQuery Hover Intent插件 - http://cherne.net/brian/resources/jquery.hoverIntent.html