Solved

Exapand/collapse Div's in html

Posted on 2012-04-12
6
188 Views
Last Modified: 2012-04-13
Hi,
  How can I implement expand/collpase panels using div's. I don't want to install any active-x controls. I want to implement something like shown in the image. Please help me how can I do it.

Thank you
expand-collpase.png
0
Comment
Question by:Sthokala
6 Comments
 
LVL 6

Expert Comment

by:bartvd
ID: 37839572
Hide the div:

div.style.display = "none";

Expand the div:

div.style.display = "block";
0
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37839746
0
 
LVL 20

Expert Comment

by:Proculopsis
ID: 37841261
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 7

Expert Comment

by:Atique Ansari
ID: 37841397
YOu can use jquery's slideToggle() function on div's click event.
0
 

Author Comment

by:Sthokala
ID: 37843034
Thank you for your answers. The code given is for horizontal panels..but I want the code to the two vertical panels. my question here is how can I insert an image in between two panels. please let me know.

Thank you
0
 
LVL 18

Accepted Solution

by:
nap0leon earned 500 total points
ID: 37843415
The panel layouts can be whatever you want.  In this example, they are named "left", "middle", and "right", but you can easily update the styles to make them "top", "middle", and "bottom" if you want...

All that is missing is that you place your image inside the div with id=middle (or set the image as middle's background) - whatever you prefer.

<script>
function toggleMiddle(){
	(document.getElementById('middle').style.display=='inline') ? document.getElementById('middle').style.display='none' : document.getElementById('middle').style.display='inline';
}
</script>
<style>
#left {border:1px solid black; height:300px; width:200px; float:left;}
#middle {border:1px solid black; height:300px; width:200px; float:left; display:none;}
#right {border:1px solid black; height:300px; width:200px; float:left;}
</style>
<div id="left">Left</div>
<div id="middle"></div>
<div id="right">Right</div>
<input type="button" onclick="toggleMiddle()">Toggle Middle DIV</input>

Open in new window

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 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

10 Experts available now in Live!

Get 1:1 Help Now