Jump to content

How do I refrence the 'class' or 'id' of a sub menu when the parent list item is clicked ?


talk2toyin

Recommended Posts

I'm trying to use jquery effects for a menu system that lists out archives pulled dynamically from the database. The menu will be like this:

 

2013>

. Jan

. Feb

. Mar

. All

 

2012>

. Jan

. Feb

. Mar

. All

 

and so on... The sub links will be hidden when the pages loads and then, on clicking any of the listed year, the sub links(months) are displayed or hidden using the jquery blind effect.

 

Here's my html:

<div class='arch'>

<ul class='nav nav-list'>

<li class='dropdown arch-dropdown'>

<a href='#' class='' toggle-dropdown='dropdown'>2013 <span class='caret'></span></a>

<ul class='arch-menu'>

<li><a href='#' class='active'>Jan</a></li>

<li><a href='#' class='active'>Feb</a></li>

<li><a href='#' class='active'>Mar</a></li>

</ul>

</li>

<li class='dropdown arch-dropdown'>

<a href='#' class='' toggle-dropdown='dropdown'>2012 <span class='caret'></span></a>

<ul class='arch-menu'>

<li><a href='#' class='active'>Jan</a></li>

<li><a href='#' class='active'>Feb</a></li>

<li><a href='#' class='active'>Mar</a></li>

</ul>

</li>

</ul>

</div>

 

I'm using Bootstrap for my HTML and CSS. Sorry if there are any mistakes in my html code, i had to type with my phone, off hand.

 

My JQuery:

$(document).function({

$(".arch-dropdown").click(function() {

$(".arch-menu").toggle("blind", 500);

});

});

 

but the above code only makes the whole sub-links of all the listed archives toggle. I can't seem to get it to work for only which was clicked. Thanks in advance.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.