themes/iphone/scrollfix.js
changeset 4 cde92f6ec29f
equal deleted inserted replaced
3:e7447a6044ec 4:cde92f6ec29f
       
     1 function getScrollOffset()
       
     2 {
       
     3   var position;
       
     4   if (self.pageYOffset)
       
     5   {
       
     6     position = self.pageYOffset;
       
     7   }
       
     8   else if (document.documentElement && document.documentElement.scrollTop)
       
     9   {
       
    10     position = document.documentElement.scrollTop;
       
    11   }
       
    12   else if (document.body)
       
    13   {
       
    14     position = document.body.scrollTop;
       
    15   }
       
    16   return position;
       
    17 }
       
    18 
       
    19 var fix_scroll = function()
       
    20 {
       
    21   var div = document.getElementById('playbar');
       
    22   div.style.top = ( String(getScrollOffset()) ) + 'px';
       
    23 }
       
    24 
       
    25 window.onscroll = fix_scroll;
       
    26