$("#nav ul li:not(:has(li.current))")
.find("ul").hide().end() // Hide all other ULs
.click(function() {
$(this).children('ul').slideToggle('fast');
});
I have the above code that uses a nested ul li, and expands the levels on click. However I’d like to contract the level on a second click, but the above contracts all the levels and not just the one being click on.
Edit: See this for example
I’m not 100% sure of what you’re intending to do, but I think you can avoid the unwanted sliding by checking to see if the event originated on the handler element:
jsFiddle