Hey all. Here is the scenario. I have the below code, and I'm needing to rearrange the items within these columns. The problem is...the items don't necessarily need to remain within their containing column, they need to be able to be switched back and forth, depending on the user. Here is the sample code:
<div id="container">
<div id="left-col">
<div class="wrapper">
<div class="item">
<h2>Row 1 Column 1</h2>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
<div class="wrapper">
<div class="item">
<h2>Row 2 Column 1</h2>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
</div><!-- end left-col -->
<div id="right-col">
<div class="wrapper">
<div class="item">
<h2>Row 1 Column 2</h2>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
<div class="wrapper">
<div class="item">
<h2>Row 2 Column 2</h2>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
</div><!-- end right-col -->
</div>
And the associated CSS:
#container {
border: 1px solid black;
overflow: hidden;
margin: auto;
}
#container .wrapper {
width: 100%;
}
#container #left-col .item {
margin: .5em .25em .5em .5em;
border: 1px solid black;
}
#container #right-col .item {
margin: .5em .5em .5em .25em;
border: 1px solid black;
}
#left-col, #right-col { width: 50%; }
#left-col { float: left; }
#right-col { float: right; }
.item h2 { background: #ccc; }
I was wondering if it was possible to use the jQuery sortable plugin to sort/order wrapper elements in the code, or if I would have to roll my own solution. The plugin could work if I was wanting to sort the elements within the left or the right column, but not between each other. Any help would be greatly appreciated.