Is it possible to target a specific class within the object using this
?
$(".main-nav-a").click(function(){
$(this).find('.sub-nav-ul').animate({height: 'toggle'});
return false;
});
Here is an example of my navigation hierarchy :
<nav class="main-nav">
<ul class="main-nav-ul">
<li class="main-nav-li"><a href="" class="main-nav-a">Home</a>
<ul class="sub-nav-ul" id="sub1">
<li class="sub-nav-li"><a href="" class="sub-nav-a">link</a></li>
<li class="sub-nav-li"><a href="" class="sub-nav-a">link</a></li>
</ul>
</li>
</ul>
</nav>
When the main-nav-a
class is clicked, can you show the sub-nav-ul
with a slide down effect using jQuery?