# HG changeset patch # User Dan # Date 1227502409 18000 # Node ID acc7755e15b6edc332c20bdf47cf571d31b29665 # Parent a4ca1e7c0073c04ea5355948661c5fb9675d0d2f ...it should be cool with scrolling now. diff -r a4ca1e7c0073 -r acc7755e15b6 scripts/volume.js --- a/scripts/volume.js Sun Nov 23 23:49:20 2008 -0500 +++ b/scripts/volume.js Sun Nov 23 23:53:29 2008 -0500 @@ -95,7 +95,7 @@ box.appendChild(field); $(box) - .css('top', (( getHeight() / 2 ) - ( $(box).Height() / 2 )) + 'px') + .css('top', (( getHeight() / 2 ) - ( $(box).Height() / 2 ) + getScrollOffset()) + 'px') .css('left', (( $(document.body).Width() / 2 ) - ( $(box).Width() / 2 )) + 'px'); $(box).fadeIn(250); @@ -163,3 +163,27 @@ } return myWidth; } + +function getScrollOffset(el) +{ + var position; + var s = el || self; + el = el || document; + if ( el.scrollTop ) + { + position = el.scrollTop; + } + else if (s.pageYOffset) + { + position = self.pageYOffset; + } + else if (document.documentElement && document.documentElement.scrollTop) + { + position = document.documentElement.scrollTop; + } + else if (document.body) + { + position = document.body.scrollTop; + } + return position; +}