themes/iphone/scrollfix.js
author Dan
Mon, 01 Sep 2008 13:05:52 -0400
changeset 39 38dbcda3cf20
parent 4 cde92f6ec29f
permissions -rw-r--r--
Fixed scroll-to-current-track being about 30 pixels off under iPhone

function getScrollOffset()
{
  var position;
  if (self.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;
}

var fix_scroll = function()
{
  var div = document.getElementById('playbar');
  div.style.top = ( String(getScrollOffset()) ) + 'px';
}

window.onscroll = fix_scroll;