I am using JQuery Accordion and it works as it should and opens and closes fine….BUT I want to add an accordion submenu and this doesn’t work nor styles either.
My libraries:
<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" />
I added this test:
<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>" a collapsable div too.
If you want accordion within an accordion then this is your solution.
By the way, when you say "#accordion" in js code, jQuery will try to find an element with id="accordion" and apply the styles to it. In the html that you have currently posted you have no such element.