title: Interrupting Mac Smooth Scroll With Javascript
body: <p>I have a script that monitors scrolling and takes control of the scrolling to animate the page based on certain parameters. To do this, it calls <code>window.scrollTo(0, currentScrollTop);</code> which perfectly interrupts the smooth scrolling in Firefox on Windows. I can then animate the page scroll to the place where I want it.</p>
  
  <p>Unfortunately, this trick doesn't appear to work in browsers in MacOS which results in a broken experience as JavaScript and the browser compete to scroll the window.</p>
  
  <p>Is there a cross-browser way to stop smooth scrolling with JavaScript?</p>
  
  <p>Site using effect in question: <a href="http://capitalismis.com" rel="nofollow">http://capitalismis.com</a></p>
  
  <p>Relevant (simplified) code:</p>
  
  <pre><code>$doc.on('scroll', function(e)
      {
          $doc.off('scroll');
  
          window.scrollTo(0, $doc.scrollTop());
  
          var aniSpeed = 1500 * Math.abs(scrollTop - selected.top) / windowHeight;
  
          $body
              .stop()
              .animate({scrollTop: selected.top}, aniSpeed, 'easeOutQuad');
       }
  );
  </code></pre>