View Full Version : Need css code to close subcategories on click

01-28-2013, 02:32 AM
I recently added a vertical accordion menu to my website but I'm having trouble trying to figure out how to close the headers on click. Here is the jquery code that should enable that function (but it doesn't):

[<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {

// Store variables

var accordion_head = $('.accordion > li > a'),
accordion_body = $('.accordion li > .sub-menu');

// Open the first tab on load


// Click function

accordion_head.on('click', function(event) {

// Disable header links


// Show and hide the tabs on click

if ($(this).attr('class') != 'active'){



I'm at a loss, Any advice would be appreciated!

01-28-2013, 08:29 PM
Anybody? :confused:

01-28-2013, 08:40 PM
Looks like you dont give enough info for anyone to help. Do you have a link to your site? All you've posted is the js. Where is the element that you're adding a class of active too? Where is the css associated with .active?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum