Make Container.height = Right_Column.height
it's simple as that :)
The column on my right changes dynamically, and since the height of the left column is set to 100%, I thought it would be good to dynam开发者_JAVA百科ically modify the height of the container depending on what the height of the Right_Column is. Any tips? Thanks :)
You could do something like this, if I understand the question correctly
var h = $('#left').height();
$('#right').css('height', h + 'px');
Example: http://jsfiddle.net/jasongennaro/KrhAP/2/
Is that what you wanted?
EDIT
As per your comment,
just add overflow:hidden;
to
.container {
width: 500px;
background-color: yellow;
overflow:hidden;
}
and change your jQuery to be this, placing it inside the click()
$("button").click(function(){
$("#right").html("adsd<BR>adsd<BR>adsd<BR>adsd<BR>adsd<BR>adsd<BR>adsd<BR>adsd<BR>adsd<BR>adsd<BR>adsd<BR>adsd<BR>adsd<BR>");
var h = $('#right').height();
$('#left').css('height', h + 'px');
});
NB: I also had to switch the #right
and #left
from my original after you changed the fiddle.
Example 2: http://jsfiddle.net/jasongennaro/wXyDq/2/
$(document).ready(function({
var x = $('#primary').height();
$('#sidebar').css('height', x);
});
This works for me, hope it helps.
精彩评论