Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

JS Query Collapse / Expand Functionality

Recently someone answered the question about how to expand / collapse list. The attached code works great for expanding/collapsing lists within a list. I need to modify the code to display all nested lists within the 1st level. Example below for "Reports". When you click on reports I want the Local (Local 1, Local 2, Local 3) and State (Ohio, Pennsylvania) to ALL display. Is this something that is modified in the javascript (http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js) or in the script added to the code. Could someone give an example of where/what would be changed?

+  Documents
   •  Document 1
   •  Document 2
+  Reports
   •  Local
      o  Local 1
      o  Local 2
      o  Local 3
   •  State
      o  Ohio
      o  Pennsylvania
+  Links
   •  www.google.com
   •  www.bing.com
Code.txt
0
Malloy1446
Asked:
Malloy1446
  • 3
  • 3
1 Solution
 
GaryCommented:
Give your top level UL a class e.g. top then change
Change
ul ul{
    display:none;  
}


to
.top>li>ul{
    display:none;  
}
0
 
Malloy1446Author Commented:
Sorry, I did not explain correctly. I want all lists collapsed when the page opens. Then if you click on one of the top level <ul> all the lists under will expand.
0
 
GaryCommented:
That's what should be happening
http://jsfiddle.net/Q5hqC/
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Malloy1446Author Commented:
My fault, I tried to put a comment with the style section and I think it negated the command. All is working correctly.

Thank you.
0
 
GaryCommented:
Don't forget to close the question if all is well
0
 
Malloy1446Author Commented:
Thanks for the help. I'm learning!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now