2011-03-28 55 views
0

我試圖讓一個下拉菜單在IE6(適用於所有其他瀏覽器)工作。 到目前爲止,我可以一次打開它(第2 +第3層)的子菜單,但我無法弄清楚如何讓它打開第二層,然後等待我在打開第三層之前盤旋。下拉菜單打開了所有的子菜單,而不是僅僅對應的層

它使用所有的CSS,符合UL UL和UL UL UL顯示:沒有,直到他們被「發現」使用這個設備 - >

#access ul li:hover > ul { 
display: block; 
} 

這是jQuery的我有,這使得第二和第三層在同一時間打開:

jQuery(document).ready(function($) { 
$('#access li').mouseover(function() { 
    $(this).find('ul').show(); 
}); 
$('#access li').mouseleave(function() { 
    $(this).find('ul').hide(); 
}); 
$('#access li ul').mouseleave(function() { 
    $(this).hide(); 
}); 
}); 

我怎樣才能讓mousover只有等到我將鼠標懸停在相應的按鈕,打開三層的開闢第二層。

在此先感謝!

PS我已經使用了幾個插件(ie7.js,whatever.hover,csshover,ie6hover等),但他們打破了頁面上的其他代碼,所以我想爲菜單提供一個簡單的解決方案。

回答

0

我認爲問題來自.find('ul'),它是找到所有嵌套列表而不是子列表。試試這個:

jQuery(document).ready(function($) { 
$('#access li').mouseover(function() { 
    $(this).children('ul').show(); 
}); 
$('#access li').mouseleave(function() { 
    $(this).find('ul').hide(); 
}); 
$('#access li ul').mouseleave(function() { 
    $(this).hide(); 
}); 
}); 
+0

太棒了!工作完美 - 謝謝! – Gertruder 2011-03-28 22:26:23

相關問題