I'm attempting to shove as much content in as little space as possible as I can and I've come up with the following layout. rather then tell you about it, I've drew up a picture to explain it, after all, a picture is worth a thousand words: https://i.stack.imgur.com/zhNcb.png
Now I've come up with this which is somewhat close to what I want, close enough that I'm tired of fiddling with it and just want to get it functional: http://jsfiddle.net/7D9XW/ html:
<div id="spacer">
<div id="wrapper">
<div id="item1" class="menuitem">text123341</div>
<div id="item2" class="menuitem">text223</div>
<div id="item3" class="menuitem">text32341</div>
</div>
<div id="content">
<div id="container1"><div id="text1">Lorem ipsum dolor sit amet</div></div>
<div id="container2"><div id="text2">consectetur adipiscing elit</div></div>
<div id="container3"><div id="text3">Vestibulum pellentesque rutrum tellus Vestibulum pellentesque rutrum tellus Vestibulum pellentesque rutrum tellus</div></div>
</div>
</div>
css:
#spacer
{
margin-top: 5%;
margin-left: 5%;
margin-right: 5%;
width: 90%;
display: inline-block;
vertical-align: top;
height: auto;
background: transparent;
z-index: -1;
}
#wrapper
{
display: table;
width: 100%;
border-spacing: 1px 0px;
border-collapse: collapse;
}
#spacer .menuitem
{
display: table-cell;
height: 1em;
padding: 1px;
}
#content
{
clear: both;
position: relative;
}
#container1
{
display: block;
vertical-align: top;
height: 0px;
overflow: visible;
width: 100%;
}
#text1
{
display: block;
background: blue;
}
#item1
{
background: blue;
}
#container2
{
display: block;
vertical-align: top;
height: 0px;
overflow: hidden;
width: 100%;
}
#text2
{
display: block;
background: green;
}
#item2
{
background: green;
}
#container3
{
display: block;
vertical-align: top;
height: 0px;
overflow: hidden;
width: 100%;
}
#text3
{
display: block;
background: red;
}
#item3
{
background: red;
}
I did some searching before I got this far and read that jquery would let me swap elements. However, what I did not read before I put this work into it was that it would only let me swap consecutive elements. I need to swap non-consecutive elements dynamically, preferably not having to rewrite the code every time I change the number of elements I need to swap. Not only do I need to swap those table cells (the ones containing text[randomnumbers]) I also need to swap the style of the content (overflow:visible makes it visible. overflow:hidden makes it..well, hidden.) How would I swap non-consecutive elements dynamically with jquery? and, as a bonus question, what could I do to make what I have closer to my original vision for the page (as seen in the image I linked earlier)?
Thanks.