Calculating the available screen height with which to work
- From: "Vaughn Haybittle" <vhaybittle@xxxxxxxxxx>
- Date: Thu, 6 Apr 2006 11:02:16 +0200
Hi,
I need assistance with calculating how many pixels I have to work with on
the vertical axis of a page:
I have three main sections in the page: a mastehead, an iframe and a div.
the masthead and iframe each have to be a particular height. what i want to
do is dynamically set the height of the div, so that the bottom of the div
is just visible above the bottom of the screen. I dont want there to be any
scrollbar on the right of the screen. the dive will have it's own scrollbar
if it's contents exceeds the height of the div.
I have tried to get the size righ, but it seems that nio matter how hard I
try I keep getting it wrong.
My code is as follows:
function setHeight()
{
var availableHeight = body.clientHeight;
var mastheadHeight = 123;
var iframeHeight = 200;
var topMargin = body.topMargin;
var bottomMargin = body.bottomMargin;
var availableY = availableHeight - logoHeight - iframeHeight -
bottomMargin - topMargin - 7;
alert(availableY);
resTree.style.height = availableY + "px";
//alert(availableY);
}
The "-7" is the height (pixels) that the div etends below the bottom of the
screen, thus causing a scroll bar to appear on the right. Can anyone tell
me if I am using the right properties to measure the space available on the
the screen?
Regards,
Vaughn
.
- Follow-Ups:
- Re: Calculating the available screen height with which to work
- From: Daniel Kirsch
- Re: Calculating the available screen height with which to work
- Prev by Date: Re: Re: problem with handling mousedown, mouseup move events to change
- Next by Date: Re: Calculating the available screen height with which to work
- Previous by thread: Re: Re: problem with handling mousedown, mouseup move events to change
- Next by thread: Re: Calculating the available screen height with which to work
- Index(es):
Relevant Pages
|