I have the following bit o' jquery:
// Code for Side Navigation
$("#sideNav ul li:not(:has(li.current))")
.find("ul").hide().end() // Hide all other ULs
.hoverIntent(
function(){
$(this).children('ul').slideDown('fast');
},
function(){
// $(this).children('ul').slideUp('fast');
}
);
It slides a nav up and down, leaving any li with the class current
open.
I would like to change it so if an li has a class current
, the ul directly beneath it would be open too, but others below that level would remain closed.
Here is the HTML structure:
<ul>
<li>Category 1
<ul>
<li class="current">Currently Open
<ul>
<li>Sub Cat 1 - should show
<ul><li>Should not Show</li></ul>
</li>
<li>Sub Cat 2 - should show</li>
</li>
</ul>
</li>
<li> Category 2
<ul><li>Should not Show></li></ul>
</li>
</ul>