我有三個層次的ul li。想要增加懸停效果的延遲時間
<ul>
<li>
<li>
<ul>
<li>
<li>
<ul>
<li>
我想增加懸停定時即當我將鼠標懸停在第二級裏的延遲時間懸停必須增加,直到我達到其子女即第三級
我有三個層次的ul li。想要增加懸停效果的延遲時間
<ul>
<li>
<li>
<ul>
<li>
<li>
<ul>
<li>
我想增加懸停定時即當我將鼠標懸停在第二級裏的延遲時間懸停必須增加,直到我達到其子女即第三級
假設你有使用javascripe代碼mouseover()
/mouseout()
或hover()
: 獲取hoverIntent插件和使用element.hoverIntent(overfunc, outfunc)
當你使用jQuery,確保你使用mouseenter
和mouseleave
,而不是mouseover
和mouseout
在這些情況下。 mouseover
和mouseout
火即使進入子元素。如果您有隱藏代碼的代碼,那麼您不希望它在當前的菜單中運行,您希望它在完全離開<li>
時運行,並且認爲孩子仍然在裏面......這就是mouseenter
和mouseleave
做:)
還有一個快捷方式對該被叫.hover()
它使用mouseenter
和mouseleave
這樣的活動:
$(selector).hover(mouseenterFunc, mouseleaveFunc);
下面是一個例子:
$("li").hover(function() {
$(this).children("ul").slideDown();
}, function() {
$(this).children().slideUp();
});
You can see the above code in a quick demo against your posted tree here
我不知道你在說什麼。 – animuson 2010-05-10 06:57:49
我想他是在談論某種下拉菜單。 – ThiefMaster 2010-05-10 08:31:34