2013-07-15 33 views
0

我使用dcdrilldown與@Tay發佈的版本this topic。當我使用linkType:'link'時它工作正常,但如果我將其更改爲linkType:'breadcrumb',它只是不正確地確定高度的大小,只顯示一個「項目」。dcdrilldown與breadcrumb沒有正確的高度尺寸

請檢查this jsfiddle以查看與breadcrumb它不顯示「貓2」,而它與linkworks perfectly。我非常想使用麪包屑,但我無法找到錯誤所在。

任何幫助將非常感激。

回答

1

您的腳本沒有在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; 
     } 
    } 

行,看看是否是所期望的行爲。

+0

完美的,我正在尋找的解決方案。 – zipp