Posted by skoch on 16. Juli 2009
/*
* getWinSize ( window )
*/
function getWinSize ( win )
{
if ( !win )
win = window;
var ret = new Object();
if ( typeof win.innerWidth != 'undefined' )
{
ret.width = win.innerWidth;
ret.height = win.innerHeight;
}
else
{
var obj = getBody ( win );
ret.width = parseInt ( obj.clientWidth );
ret.height = parseInt ( obj.clientHeight );
}
return ret;
}
/*
* Der IE hat 2 verschiedene Objekte für den strict und quirks Mode.
*/
function getBody ( win )
{
return ( win.document.compatMode && w.document.compatMode == "CSS1Compat" ) ? w.document.documentElement : w.document.body || null;
}
Filed under: JavaScript
Leave a Reply
You must be logged in to post a comment.