Alex Burrows Design

Alex Burrows Design is a freelance web & design company based in the heart of Surrey in the small town of Ashtead.

  • home
  • services
  • work
  • contact
  • blog
  • offers

Categories

  • Clients
  • Personal Stuff
  • Reviews
  • Techy Chat
  • Tutorials
    • Drupal
    • jQuery

Making a simple jQuery accordian navigation

Posted on May 19th, 2009 by Alex


At work today I came across the issue of having to make navigation work like an accordian. First I went to the jQuery UI site and looked at the code, added it in and tested it.

Unfortunatley it didn’t work how I wanted. So the next step was to maybe incorporate it into a PHP solution, so when it looks up the data in the table it echos the id into the jQuery code. This still did not work how I wanted becuase the navigation was coded into a function.
I remembered seeing something about how the find() function in jQuery looks for a certain tag, so I coded this.

$(’ul#nav li ul’).hide();

$(’ul#nav li’).click(function(){ // when the li (list item) is clicked it runs the function

$(this).find(this).children(’ul’).slideToggle(500); // it now looks for the child ul within the ul li from above and applies the jQuery slideToggle effect.

});

Very simple, yet very effective!

Tags: accordian, find(), jquery, navigation

2 Responses to “Making a simple jQuery accordian navigation”

  1. agyvonyre Says:


    agyvonyre…

    Jackson Kid Shar …

    August 23rd, 2009 at 11:17 pm

  2. JEFFREY Says:



    Pillspot.org. Canadian Health&Care.Best quality drugs.Special Internet Prices.No prescription online pharmacy. Low price drugs. Order drugs online…

    Buy:Nexium.Prednisolone.Zovirax.Prevacid.Lumigan.Mega Hoodia.Accutane.Valtrex.Human Growth Hormone.Actos.Synthroid.Arimidex.Petcam (Metacam) Oral Suspension.Zyban.Retin-A.100% Pure Okinawan Coral Calcium….

    July 15th, 2010 at 3:34 pm

Leave a Reply


Interesting Events

JavaScript Conference - 20th November
  • rssRSS Entries
  • rssRSS Comments

Archives

  • February 2010
  • October 2009
  • July 2009
  • May 2009
  • April 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • August 2008

Search Blog

© 2010 Alex Burrows Design. All Rights Reservered.
Valid XHTML & CSS
Blog Powered by WordPress