thedarkness

Dudes,

I need a cross browser solution to being able to determine the height of a scrollable window in

javascript

  so I can position an image in the middle of the visible window regardless of the scrolled position. I can do the width OK and the height of the window without any scolling, but the height once the window starts scrolling has so far eluded me. I have googled this for an hour or so this afternoon but got very little gratification.

All donations cheerfully accepted  Applause

TIA,
td 

perkiset

This will handle the browser BODY, but not a scrollable div if that's what you're looking for. IF you find a way to interrogate/manipulate the thumb of a scrollable div I've got a 6pack waiting for you pal...

function browserWindowHeight()
{
if ((document.all) && (document.getElementById))
{
return document.body.offsetHeight;
} else {
return window.innerHeight;
}
}
function browserWindowWidth()
{
if ((document.all) && (document.getElementById))
{
return document.body.offsetWidth;
} else {
return window.innerWidth;
}
}


Perkiset's Place Home   Politics @ Perkiset's