您的腳本沒有在ul#drilldown-2
菜單容器上正確設置高度。菜單選擇在那裏,但容器上的固定高度對於他們來說顯得太小了。您使用的版本假定您的頂級菜單隻有一個條目。
http://jsfiddle.net/TLuBN/8/
找到這個函數:
function findMaxHeight(element) {
var maxIndex = undefined;
$(element).each(function() {
var val = parseInt($('> li', this).length);
$(this).attr('rel', val);
if (maxIndex === undefined || maxIndex < val) {
maxIndex = val;
}
});
if ($(element).find('li').length > maxIndex) {
//the longest 'submenu' could be the root menu
return 1;
} else {
return maxIndex;
}
}
和改變,說return 1;
到return $(element).closest('.dd-menu').find('> li').length;
,所以它讀取
function findMaxHeight(element) {
var maxIndex = undefined;
$(element).each(function() {
var val = parseInt($('> li', this).length);
$(this).attr('rel', val);
if (maxIndex === undefined || maxIndex < val) {
maxIndex = val;
}
});
if ($(element).find('li').length > maxIndex) {
//the longest 'submenu' could be the root menu
return $(element).closest('.dd-menu').find('> li').length;
} else {
return maxIndex;
}
}
行,看看是否是所期望的行爲。
完美的,我正在尋找的解決方案。 – zipp