Solved

JS Query Collapse / Expand Functionality

Posted on 2014-02-05
6
314 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
arrays and radio buttons 10 40
Table doesn't show the lines! 3 25
center navbar (navigation menu) on web page 3 27
Embedd an image or live dashboard into Slack 1 20
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
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).

697 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