jQuery
New Wave Javascript
discuss » Tree Menu using jQuery
Posted: Thu Mar 9 06:52:45 EST 2006
From: Steve Urmston <
stevechamp at gmail.com
>
Hi folks
Using the following html;
<ul id="masternav">
<li><a href="stuff">parent link</a>
<ul>
<li><a href="stuff">child link</a></li>
</ul>
</li>
</ul>
Basically I want to show the sub ul when the parent li is clicked.
However I can't seem to hit only the parents, and clicking any link
slides the ul up/down, when I need the sub links to work as normal
links.
Any clues how I should be going about this?
js -------
$(document).ready(function(){
$("#masternav").find("li").toggle(function(){
$(this).find("ul").slideDown("medium");
},function(){
$(this).find("ul").slideUp("medium");
return false;
});
});
Cheers,
steve