Reputation: 5692
I know almost nothing about JS so I just thought I would ask. I saw this in another thread:
<script type="text/javascript">
function contentSize()
{
document.getElementById('content').style.height=(window.availHeight-40)+"px";
}
onload=contentSize;
onresize=contentSize;
<script>
Looks straight forward but doesn't work...
Upvotes: 0
Views: 6294
Reputation: 808
If you do use jQuery, then http://api.jquery.com/height/
IE supplies this info differently than Chrome/FF/Safari so probably better if you do use the lib to help cover all the bases. You can use the height() function both to get the size of the window and set the height of your target content.
$('#mydiv').height( $(window).height() - 100 );
Upvotes: 3