Ever used a modal window? I know that I have.
One of the main problems with it, that when you open it, the background element does not fill the entire document, but only the visible area. For this reason we use a function that gives us the entire scrolling height of the body/documentElement.
//----------------------------------------------------
// getScrollHeight
// return - entire document height
//----------------------------------------------------
function getScrollHeight() {
var d = document.body;
var de = document.documentElement;
return Math.max(d.scrollHeight,
de.scrollHeight,
d.offsetHeight,
de.offsetHeight,
d.clientHeight,
de.clientHeight
);
}
To use it in a script just write something like:
document.getElementById('modalWindow').style.height = getScrollHeight() + 'px';
Wednesday, October 20, 2010
Sunday, October 17, 2010
Word 2007
Well well well….
Apparently you can post directly from word 2007. It took me only 5000 years to find it!
So now that I know this small and unimportant issue I'll post more frequently.
Cheers for now.
Subscribe to:
Comments (Atom)
