Solved

JS Query Collapse / Expand Functionality

Posted on 2014-02-05
6
313 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

856 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