2011-12-28 109 views
1

我正在使用JQuery手風琴,它的工作原理和打開和關閉罰款....但我想添加一個手風琴子菜單,這不工作,也不是樣式。JQuery手風琴SubMenu /嵌套不工作

我的圖書館:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> 
<script src="http://code.jquery.com/jquery-1.7.1.min.js" type="text/javascript"></script> 
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script> 
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/start/jquery-ui.css" type="text/css" rel="Stylesheet" /> 

我說這個測試:

<p><a href="#">TEST MAIN MENU</a></p> 
<div> 

<h3><a href="#">Sub header</a></h3> 
<div>sub content here</div> 

</div> 

and "Sub header" is not styled as a header nor it wraps up the div below it like "TEST MAIN MENU" does... 

On the <head> I have this: 

<script> 
     $(function() { 
      $("#accordion").accordion({ 
        active: false, 
      autoHeight: false, 
      collapsible: true, 
      alwaysOpen: false 
      }); 
     }); 

     function collapseAll() { 
    $("#accordion") 
     .filter(":has(.ui-state-active)") 
     .accordion("activate", -1); 
    $(".ui-accordion-header").blur(); 
} 

</script> 

All I need is to make "<h3><a href="#">Sub header</a></h3>"一個可摺疊的div了。

回答

3

如果你想要一個手風琴然後this is your solution.

順便說一句,內手風琴當你說的js代碼「#accordion」,jQuery將嘗試找到ID =「手風琴」的元素和樣式應用到它。在你目前發佈的html中沒有這樣的元素。

1

手風琴中不能有子菜單。

「和」子標題「不是樣式作爲標題」,CSS在哪裏?你的意思是不是作爲標題的樣式?

你能舉一個你想要什麼的例子嗎?

+0

此答案包含2個問題。你爲什麼說你不能有一個子菜單?請證明。 – 2011-12-28 13:48:43

+0

還有1個答案 – Richard 2011-12-28 13:50:37

+0

嗯,看看這個http://jsfiddle.net/qdSu5/ – 2011-12-28 13:51:49