Using Accordion as navigation menu
I'm totally new to JS and i could really use some help with this.
I'm doing a navigation menu using the accordion. Everything work fine
when it follows the "header, ul, header, ul" rhythm, but when a
category doesn't have subcategories listed after it, everything messes
up.
How do i fix that? Thanks in advance.
This is my HTML structure:
<div class="accordion">
<h2>Category 1</h2>
<ul>
<li><a href="#">Subcategory 1</a></li>
<li><a href="#">Subcategory 2</a></li>
<li><a href="#">Subcategory 3</a></li>
<li><a href="#">Subcategory 4</a></li>
</ul>
<h2>Category 2 (WITHOUT SUBCATEGORIES!!!)</h2>
<h2>Category 3</h2>
<ul>
<li><a href="#">Subcategory 1</a></li>
<li><a href="#">Subcategory 2</a></li>
</ul>
<h2>Category 4</h2>
<ul>
<li><a href="#">Subcategory 1</a></li>
<li><a href="#">Subcategory 2</a></li>
</ul>
</div>
--