Results 1 to 3 of 3

Thread: jQuery Accordian as menu problem

  1. #1
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default jQuery Accordian as menu problem

    Hey guys,

    I'm new here and I've just finished my website. I got some usage feedback and a problem with my jquery accordian menu has come up. I'd like to caution I'm really amateur, not a web coder at all - I'm a graphic designer for identity and print, but I've some how over 7/8 months managed to build my site - http://www.asheck.com/ to what it is now. its not perfect but I'm working on the issues...

    I have with my accordian menu so if we click on items, it drops down and we if we click another menu item it closes the previous item and opens the new one which is fine. The problem is which people have found annoying is, if you click a menu item and then click the SAME one again, it collapses then springs opens again... instead of just closing - is there a way to fix this?

    The code that codes this is as follows...
    Code:
    	
    jQuery(document).ready(function(){
    	jQuery( '#menu > li > ul' ).hide()	
    	jQuery('#menu > li').addClass('inactive');
    	
    	jQuery('#menu > li').click(function(e){
    	  jQuery('#menu > li > ul').slideUp();
    	  jQuery('#menu > li').addClass('inactive');
    	  jQuery('ul',this).slideDown();
    	  jQuery(this).removeClass('inactive');
        }, function(){
      	jQuery( this ).parent().find('ul').slideUp();
      });
    });
    Any help would be appreciated, its been driving me nuts trying to get this sorted I only just managed to have it so that menu's collapse when another item gets clicked...

    Cheers.
    Last edited by monkey; 12-02-2011 at 01:48 PM.

  2. #2
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    did you want the slide up to not happen? how about just commenting out this
    Code:
    jQuery(document).ready(function(){
    	jQuery( '#menu > li > ul' ).hide()	
    	jQuery('#menu > li').addClass('inactive');
    	
    	jQuery('#menu > li').click(function(e){
    	  //jQuery('#menu > li > ul').slideUp();
    	  jQuery('#menu > li').addClass('inactive');
    	  jQuery('ul',this).slideDown();
    	  jQuery(this).removeClass('inactive');
        }, function(){
      	jQuery( this ).parent().find('ul').slideUp();
      });
    });

  3. #3
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ^thanks for the response, but I've managed to solve it with the help of a friend - you can see now what I mean in terms of how I wanted it. now I just need to solve the ie7 and 8 issues...lol...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •