themes/iphone/scrollfix.js
author Dan
Wed, 26 Mar 2008 10:24:20 -0400
changeset 12 b3fcc21e557f
parent 4 cde92f6ec29f
permissions -rw-r--r--
Backend improvement to webserver that causes interrupts to work properly; made pcntl_signal only be called if it's supported
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
     1
function getScrollOffset()
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
     2
{
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
     3
  var position;
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
     4
  if (self.pageYOffset)
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
     5
  {
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
     6
    position = self.pageYOffset;
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
     7
  }
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
     8
  else if (document.documentElement && document.documentElement.scrollTop)
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
     9
  {
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    10
    position = document.documentElement.scrollTop;
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    11
  }
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    12
  else if (document.body)
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    13
  {
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    14
    position = document.body.scrollTop;
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    15
  }
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    16
  return position;
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    17
}
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    18
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    19
var fix_scroll = function()
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    20
{
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    21
  var div = document.getElementById('playbar');
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    22
  div.style.top = ( String(getScrollOffset()) ) + 'px';
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    23
}
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    24
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    25
window.onscroll = fix_scroll;
cde92f6ec29f Should be completely iPhone/iPod Touch-friendly now :)
Dan
parents:
diff changeset
    26