Fixed position of floating volume div
authorDan
Sun, 23 Nov 2008 23:49:20 -0500
changeset 59 a4ca1e7c0073
parent 58 05a69bab5f10
child 60 acc7755e15b6
Fixed position of floating volume div
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;
+}