I have a number of container divs each holding other column divs, I have tried a JavaScript script to make the half column divs resize at the same height. This has worked but this means that all the other half divs on the page resize to that height. See screenshot below. The half divs have the same ID but in different containers. Is there jQuery or JavaScript code that can resize the height across divs within each individual container?
In the screen shot the top row is one container, the bottom row has the div within a different container. I want the bottom row div to resize to match the height of the tallest div within that separate container. But I want to workout several containers that all resize the inner divs across the page.
Part of the code:
<style>
#page{width:85%; text-align:center;margin:auto;}
#row{width:100%;background:yellow;margin-bottom:1%;}
#container{height: auto;display: table;float:left;}
#header{width:100%;background-color: rgb(0, 143, 213); height:50px;}
#full{width:99%;margin:0.5%;background-color:skyblue;}
.half{width:48%; margin:0.5%;padding:0.5%;float:left; background-color:#1589FF;display: table-cell;}
#third{width:32.333%; float:left; margin:0.5%; background-color:skyblue;}
#th2{width:65.66%; float:left; margin:0.5%; background-color:skyblue;}
#quarter{width:23%; margin:0.5%;padding:0.5%; float:left; background-color:blue;height:100px}
</style>
<script type='text/javascript'>
$(window).load(function(){
$(window).resize( function() {
var $column = $('.column'),
maxHeight = 0;
$column.each( function() {
$(this).removeAttr('style');
if($(this).height() > maxHeight) {
maxHeight = $(this).height();
}
});
$column.height(maxHeight);
}).trigger('resize');
});
</script>
</head>
<body>
<div id="full">Menu</div>
<div id="th2">2/3</div><div id="third">Third</div>
<div id="container">
<div class="half column"><h1>About</h1><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sodales urna non odio egestas tempor. Nunc vel vehicula ante. Etiam bibendum iaculis libero, eget molestie nisl pharetra in. In semper consequat est, eu porta velit mollis nec.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sodales urna non odio egestas tempor. Nunc vel vehicula ante. Etiam bibendum iaculis libero, eget molestie nisl pharetra in. In semper consequat est, eu porta velit mollis nec. Curabitur posuere enim eget turpis feugiat tempor. Etiam ullamcorper lorem dapibus velit suscipit ultrices. Proin in est sed erat facilisis pharetra.</div>
<div class="half column"><h1>News</h1><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sodales urna non odio egestas tempor. Nunc vel vehicula ante. Etiam bibendum iaculis libero, eget molestie nisl pharetra in. In semper consequat est, eu porta velit mollis nec.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam sodales urna non odio egestas tempor. Nunc vel vehicula ante. Etiam bibendum iaculis libero, eget molestie nisl pharetra in.
</div>
</div>
<div id="container2">
<div class="half column">Half<br>more info</div><div id="quarter">Quarter</div><div id="quarter">Quarter</div>
</div>
</div>