Hey guys,
I'm making something really generic - just a collapsible menu list, actually i'm trying to emulate the wordpress admin menus. For some reason beyond my understanding, I manage to get slideToggle to slide open the menus, but they don't close back when I click on the toggle anchor again. This is the jquery:
$(document).ready(function() {
$('.menu-collapse').click(function(e){
e.preventDefault();
$(this).next('.admin-submenu').slideToggle();
});
});
This is the markup
<ul>
<li class="top"><a href="" class="menu-item">Dashboard</a></a></li>
<li class="top"><a href="" class="menu-item">Products</a><a href="" class="menu-collapse">
<div class="admin-submenu">
<ul>
<li class="sub"><a href="">My Products</a></li>
<li class="sub"><a href="">Add New</a></li>
</ul>
</div>
</li>
<li class="top"><a href="" class="menu-item">Lists</a><a href="" class="menu-collapse">
<div class="admin-submenu">
<ul>
<li class="sub"><a href="">Brands</a></li>
<li class="sub"><a href="">Colors</a></li>
<li class="sub"><a href="">Locations</a></li>
<li class="sub"><a href="">Manufacturers</a></li>
</ul>
</div>
</li>
</ul>
Can anyone help please ?