Explaining this may be a bit challenging, so please bear with me.
The webpage layout includes a column divided into two panels/sections. The aim is to have the secondary panel expand to occupy the remaining space when one of the panels is minimized.
When Panel 1 is minimized, the list disappears, and Panel 2's header moves up directly below Panel 1 while expanding to fill the rest of the column space.
If Panel 2 is minimized, its list hides, the header goes to the bottom of the page, and Panel 1's list expands to fit the remainder of the column.
Fiddle: http://jsfiddle.net/mL9RG/
Collapsing the lists within the sections using slideToggle works seamlessly. Although incorporating fixed CSS height animations somewhat achieves the desired effect, using percentages for responsiveness has proven challenging.
HTML
<div id="wrapper">
<div id="section1">
<h2 id="crossbar1">Section 1<span id="plus2">+/-</span></h2>
<ul id="list1">
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
<li>Stuff</li>
</ul>
</div>
<div id="section2">
<h2 id="crossbar2">Section 2 <span id="plus2">+/-</span></h2>
<ul id="list2">
<li>Stuff</li>
<li>More Stuff</li>
<li>Stuff</li>
</ul>
</div>
</div>
CSS
#wrapper { width: 200px; height: 400px; margin: 0 auto; background-color: #eaeaea; }
ul { margin: 0; padding: 0; list-style: none; display: block; }
h2 { margin: 0; padding: 5px 0; background-color: #d8d8d8; position: relative; }
h2 span { position: absolute; right: 10px; font-size: 15px; top: 10px; cursor: pointer }
#section1 {
height: 50%; width: 100%; background-color: blue;
box-sizing: border-box;
}
#section2 {
height: 50%; width: 100%; background-color: green;
}
Jquery
$('#crossbar1').click(function(){
$('#list1').slideToggle();
});
$('#crossbar2').click(function(){
$('#list2').slideToggle();
});