JQuery手风琴SubMenu /嵌套不工作

问题描述:

我正在使用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了。

如果你想要一个手风琴然后this is your solution.

顺便说一句,内手风琴当你说的js代码“#accordion”,jQuery将尝试找到ID =“手风琴”的元素和样式应用到它。在你目前发布的html中没有这样的元素。

手风琴中不能有子菜单。

“和”子标题“不是样式作为标题”,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