If i have the following markup;
<div id="container">
<div id="box">
<div id='sameHeight'>One<br>two<br>three</div>
<div id='sameHeight'>four</div>
<div id='sameHeight'>five</div>
<div>
<div id="box">
<div id='sameHeight'>four</div>
<div id='sameHeight'>six</div>
<div id='sameHeight'>seven<br>eight</div>
<div>
</div>
How can I ensure that all divs marked as "sameHeight" are the same height as their counterparts in the other div?
I had a look at the equalHeights plugin but that assumes all divs side by side are in the same parent. I need one that can either traverse parents or allow me to specify parents.
Is there such a thing or do I need to write it?
EDIT
I seem to have caused some confusion in my explanation so I hope this clears things up a little.
Looking at the new markup, the container is a simple box.
The "box" divs sit side by side.
Each sameheight div then sits one under the other within its parent.
The thing i'm trying to solve is to have each of the sameHeights that match to it's opposite side the same height.
it should look like a grid i guess w/out using a grid.
I hope this helps.
EDIT 2
This is so far what I have come up with but is there a better way?
function SetHeights() {
var numLines = $('#container>div:eq(0) .sameHeight').length;
for (var t = 0; t < numLines; t++) {
var leftHeight = $('#container>div:eq(0) .sameHeight:eq(' + t + ')').outerHeight();
var rightHeight = $('#container>div:eq(1) .sameHeight:eq(' + t + ')').outerHeight();
if (leftHeight > rightHeight) {
$('#container>div:eq(1) .sameHeight:eq(' + t + ')').css({ height: leftHeight });
}
else {
$('#container>div:eq(0) .sameHeight:eq(' + t + ')').css({ height: rightHeight });
}
}
}