我建立了一个简单的菜单jQuery的如何解决不稳定的动画jQuery的
http://vanquish.websitewelcome.com/~toberua/
这是菜单的样本
<ul>
<li id="your-residences">
<strong>Your Residences</strong>
<ul>
<li class="menu-1"><a href=
"/~toberua/your-residences/deluxe-ocean-front-bure/">Deluxe
Ocean Front Bure</a></li>
<li class="menu-2"><a href=
"/~toberua/your-residences/premium-ocean-front-bure/">Premium
Ocean Front Bure</a></li>
</ul>
</li>
<li id="your-island">
<strong>Your Island</strong>
<ul>
<li class="menu-1"><a href=
"/~toberua/your-island/where-is-toberua/">Where is
Toberua?</a></li>
<li class="menu-2"><a href=
"/~toberua/your-island/island-facilities/">Island
Facilities</a></li>
<li class="menu-3"><a href=
"/~toberua/your-island/massage-and-spa/">Massage &
Spa</a></li>
</ul>
</li>
</ul>
这里是我的jQuery:
var menu = {
init: function() {
$('#header > ul > li').hoverIntent(function() {
$(this).find('ul').show().css({opacity: '0.3'}).height(0).animate({height: '88px', opacity: '1.0'}, 800);
}, function() {
$(this).find('ul').animate({height: '0', opacity: '0.3'}, 400, function() { $(this).hide(); });
});
}
}
这产生了一些古怪的行为。例如,有时菜单会滑落,然后继续向上和向下滑动。其他令人讨厌的是菜单完美地滑落,然后在它再次回来之前闪烁到空白背景。
有没有人有任何指针,我可能做错了什么?
谢谢
需要更多的代码,什么是hoverIntent在做什么? – 2009-05-06 05:33:11
hoverIntent是一个插件,旨在使悬停工作更好..没有排队的事件,这导致他们一个接一个地被解雇。我也提供了一个链接。 – alex 2009-05-06 05:34:34