Javascript design tutorial fix for 100% document height

Status
Not open for further replies.

Zoli

Yellow Belt
I think it might happened to you as well that you put your content together and the footer element was not at the bottom of the page but was at higher verical position since the main content holder div had smaller height value. I hope you still could follow me so far.
I have compiled the following script in order to stretch the height of the main content holder div element to provide 100% documentum height.

Code:
var totalheight = document.body.offsetHeight;
var B=navigator.appVersion;
if(B=="Netscape"||B=="Opera"){
var should=window.innerHeight;}
else{
var should=document.documentElement.clientHeight;
}
var other=229;
var optimal=should-other +'px';
if (totalheight<=should){
document.getElementById('contentholder').style.height=optimal;}
There are only two things need to get customized:
i. The value of the other variable (var other) - Write here the summation height of every document element which affect the vertical stretching.
ii. The ID of the contentholder element. All you need to do is to replace the contentholder with the suiteable one.
 
Status
Not open for further replies.
Top