Solved

JS Query Collapse / Expand Functionality

Posted on 2014-02-05
6
310 Views
Last Modified: 2014-02-05
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
Comment
Question by:Malloy1446
  • 3
  • 3
6 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39836616
Give your top level UL a class e.g. top then change
Change
ul ul{
    display:none;  
}


to
.top>li>ul{
    display:none;  
}
0
 

Author Comment

by:Malloy1446
ID: 39836725
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
 
LVL 58

Expert Comment

by:Gary
ID: 39836735
That's what should be happening
http://jsfiddle.net/Q5hqC/
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:Malloy1446
ID: 39836770
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
 
LVL 58

Expert Comment

by:Gary
ID: 39837672
Don't forget to close the question if all is well
0
 

Author Closing Comment

by:Malloy1446
ID: 39837926
Thanks for the help. I'm learning!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to create an extensible mechanism for linked drop downs.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now