The coding is done using VS2008 There are two divs in my page namely "dvLeftContent" and "dvRightContent". I cannot statically set the height of the pages since "dvRightContent" have variable heights on various pages (Master Pages are used here) Is there a client side function(javascript or jquery) that takes the height of the right div and assigns it to left div?
A:
Using jQuery:
$("#dvRightContent").bind("resize", function(){
$("#dvLeftContent").css('height', $("#dvRightContent").css('height'));
});
micahwittman
2008-10-23 06:47:32
A:
Thanks micahwittman. Some minor changes
$("#dvRightContent").resize(function(){
$("#dvLeftContent").css("height", ($("#dvRightContent").attr("offsetHeight") - 250 ) +"px");
});
Its because height will give only "auto" in this case as its set like that
naveen
2008-10-23 08:40:55
Interesting. You're welcome, btw. Also, just did a quick edit to fix typo on my username.
micahwittman
2008-10-23 15:01:43
A:
There is also a jQuery plugin which does the job for you: Equalize
It handles both the scenario where rightcol is larger then leftcol or where leftcol is larger than rightcol. It also allows you to specify which element inside either leftcol or rightcol should get the space added.
mlarsen
2008-10-23 08:54:13
A:
Hi mlarsen, Will this plugin works if the div changes(using js without a postback) after the page is loaded?
naveen
2008-10-23 09:07:54
I cannot see why it wouldn't. You just call jQuery.Equalise("#col1", "#col2") again after the content has changed.
mlarsen
2008-10-23 18:34:46
A:
Hi micahwittman, yeah i know. I posted it for any future reference. Thanks pal
naveen
2008-10-24 08:36:14