title: Why won't Chrome for Mobile redraw my fixed header?
body: <p>I have a header which I would like to control the visibility of while scrolling. When scrolling down the page, the header should operate as any element would. When scrolling up the page, regardless of page position, I would like to show the header as the page ascends. This behavior can be best understood by observing a <a href="https://jsfiddle.net/dm152r89/1/show/" rel="nofollow">simple example</a>.</p>
  
  <p>I am listening for scroll events and updating a fixed position div with a negative top value:</p>
  
  <pre><code>$(function()
  {
      var $header = $("#header");
      var $window = $(window);
  
      var headerHeight = $header.outerHeight();
      var headerY = $header.outerHeight();
      var scrollY = $window.scrollTop();
  
      $window.on("scroll", function()
      {
          headerY += scrollY - $window.scrollTop();
          if (headerY &gt; headerHeight)
          {
              headerY = headerHeight;
          }
          else if (headerY &lt; 0)
          {
              headerY = 0;
          }
          $header.css(
              {
                  top: headerY - headerHeight,
              });
          scrollY = $window.scrollTop();
      });
  });
  </code></pre>
  
  <p>However, the behavior in Chrome for Mobile is not at all what I would expect. The header often does not animate and will instantly appear or disappear when the bounds are met. When it does animate, the performance is haltingly irregular and often only draws one to three frames. This behavior is not exhibited when using desktop Chrome's mobile emulation; it only occurs on an actual device.</p>
  
  <p>This only seems to happen when dealing with a fixed position element at the top of the page. If I attempt to alter a fixed element in a different manner, such as moving it in from a side or the bottom, everything works much closer to expected. In fact, if I alter both a fixed position top element and fixed position side element, the top element will behave more uniformly, <a href="https://jsfiddle.net/dm152r89/2/show" rel="nofollow">like so</a>.</p>
  
  <p>Why is Chrome for Mobile so erratic with fixed position elements at the top of the page? Is there any way I can account for it in a succinct way?</p>