To retrieve the window size, we will write a function called:
getWindowSize()
We shall set it to return an array of two values, the width and the height:
function getWindowSize () {
theHeight = ( typeof( window.innerHeight ) == 'number' )?window.innerHeight:( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )?document.documentElement.clientHeight:document.body.clientHeight;
theWidth = ( typeof( window.innerWidth ) == 'number' )?window. innerWidth:( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )?document.documentElement.clientWidth:document.body. clientWidth;
return [ scrOfX, scrOfY ];
}