theniteowl
Programmer
Hi All,
I have been attempting to use innerHeight and innerWidth in FireFox to get the dimensions of the display window without the scrollbars added in but for some reason it returns the values WITH the scrollbars????
I wondered why my positioning code was not correctly preventing objects going off the bottom of the screen in FireFox so I started displaying the values only to find out that the innerHeight/Width properties include the scrollbars even though those are supposed to exclude scrollbars in the value.
I use the code below to detect the browser type and set the values into global variables. I confirmed that it properly detects the browser method to use by placing alerts in each position and seeing that only the first method executes.
Any ideas?
From what I read this should never include the scrollbar widths. I even captured the window and dropped it into an image editor to check dimensions and sure enough the reported values go inside the window border but outside of the scrollbars.
Paranoid? ME?? Who wants to know????
I have been attempting to use innerHeight and innerWidth in FireFox to get the dimensions of the display window without the scrollbars added in but for some reason it returns the values WITH the scrollbars????
I wondered why my positioning code was not correctly preventing objects going off the bottom of the screen in FireFox so I started displaying the values only to find out that the innerHeight/Width properties include the scrollbars even though those are supposed to exclude scrollbars in the value.
I use the code below to detect the browser type and set the values into global variables. I confirmed that it properly detects the browser method to use by placing alerts in each position and seeing that only the first method executes.
Code:
function setScrSize() {
if (self.innerWidth)
{
scrWidth = self.innerWidth;
scrHeight = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientWidth)
{
scrWidth = document.documentElement.clientWidth;
scrHeight = document.documentElement.clientHeight;
}
else if (document.body)
{
scrWidth = document.body.clientWidth;
scrHeight = document.body.clientHeight;
}
}
Any ideas?
From what I read this should never include the scrollbar widths. I even captured the window and dropped it into an image editor to check dimensions and sure enough the reported values go inside the window border but outside of the scrollbars.
Paranoid? ME?? Who wants to know????