rex
rex

Reputation: 1025

jQuery logic not working properly

Found a really nice code for Accordion nav and am trying implement on our website, but due to certain restrictions I cannot change the HTML codes or new version on jQuery. The example is based on div/class names but we are using ul > li listing. I am not really getting the child parent relationship. Any help is appreciated. Thanks

The code is set up on JSfiddle http://jsfiddle.net/rexonms/kn3t6/1/

Upvotes: 0

Views: 47

Answers (1)

SoWeLie
SoWeLie

Reputation: 1391

Here you are, fixed the jsfiddle to work with your html:

http://jsfiddle.net/kn3t6/6/

Changed this code:

 //Main code that should work  
 $(this).parent().slideDown(500).siblings((this).parent).slideUp("slow");

To this code:

// hide other lists
$(this).parent().siblings().find("ul").slideUp("slow");

// show the current list
$(this).parent().find("ul").slideDown(500);

Upvotes: 1

Related Questions