themes/iphone/scrollfix.js
author Dan
Tue, 26 May 2009 15:24:26 -0400
changeset 68 32f6e2ee15ab
parent 4 cde92f6ec29f
permissions -rw-r--r--
WebServer: fixed longstanding non-security fwrite buffer overflow bug
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