views:

95

answers:

2

I have a setup lets say like follows:

<div id="nav">
   <div id="innernav">
      //With dynamic content here.
   </div>
</div>

I am running a script that sizes #nav to the size of the browser window in height. But sometimes my dynamic content is now getting bigger than the height of the window.. Is there a way I can enforce that when #innernav exceeds #nav that #nav will increase in size?

Seen as someone asked for the script:

    function resizeWindow(){var a=getWindowHeight();document.getElementById("content").style.height=(a-0)+"px";document.getElementById("nav").style.height=(a-0)+"px";document.getElementById("contentPanel").style.height=(a-10)+"px"}function getWindowHeight(){var a=0;if(typeof(window.innerHeight)=="number"){a=window.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientHeight}else{if(document.body&&document.body.clientHeight){a=document.body.clientHeight}}}return a};

Changed the script to refer to min-height works perfectly in FireFox. But not IE or Chrome.

CSS:

body {
margin: 0px;
text-align: left;
font-family: Verdana;
font-size: 11px;
background-color: #FFFFFF;
min-width: 980px;
min-height: 10px;
background-image: url('../Images/watermark.png');
background-position: 100% 100%;
background-repeat: no-repeat;
}


.nav {
width: 19%;
margin: 0px 0px 0px 0px;
background-color: #E0EFFF;
float: left;
vertical-align: bottom;
position: relative;       
}

some minor changes to my script / using min height seems to work. And after running a CCLEAN IE sort of does what I wanted.

+2  A: 

Instead of setting the "height", set the "min-height".

Syd
Watch out for browser compatibility on min and max.
Evan Plaice
Changed it to min height and the it still won't expand when the content goes past the window border.
Thqr
min height works in Firefox. But not chrome or IE.
Thqr
which IE version? I have it implemented in IE 7 and IE 8 and it should work.
Syd
IE8.It will not resize the div at all. It sits at starting size.
Thqr
Hmm.. definitely min-height and I was using this script: $("#main").css("min-height", $(window).height() - 120);
Syd
A: 

short solution is give height auto to both divs

kamal