# HG changeset patch # User Dan # Date 1227502160 18000 # Node ID a4ca1e7c0073c04ea5355948661c5fb9675d0d2f # Parent 05a69bab5f10c01ae67111f3977fc40f47003ad3 Fixed position of floating volume div diff -r 05a69bab5f10 -r a4ca1e7c0073 scripts/volume.js --- a/scripts/volume.js Sun Nov 23 23:43:59 2008 -0500 +++ b/scripts/volume.js Sun Nov 23 23:49:20 2008 -0500 @@ -95,7 +95,7 @@ box.appendChild(field); $(box) - .css('top', (( $(window).Height() / 2 ) - ( $(box).Height() / 2 )) + 'px') + .css('top', (( getHeight() / 2 ) - ( $(box).Height() / 2 )) + 'px') .css('left', (( $(document.body).Width() / 2 ) - ( $(box).Width() / 2 )) + 'px'); $(box).fadeIn(250); @@ -137,3 +137,29 @@ } } }); + +function getHeight() { + var myHeight = 0; + if( typeof( window.innerWidth ) == 'number' ) { + myHeight = window.innerHeight; + } else if( document.documentElement && + ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { + myHeight = document.documentElement.clientHeight; + } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { + myHeight = document.body.clientHeight; + } + return myHeight; +} + +function getWidth() { + var myWidth = 0; + if( typeof( window.innerWidth ) == 'number' ) { + myWidth = window.innerWidth; + } else if( document.documentElement && + ( document.documentElement.clientWidth || document.documentElement.clientWidth ) ) { + myWidth = document.documentElement.clientWidth; + } else if( document.body && ( document.body.clientWidth || document.body.clientWidth ) ) { + myWidth = document.body.clientWidth; + } + return myWidth; +}