title: Is it possible to determine where a scroll will end up using javascript? If so, how?
body: <p>I have a situation where, for example, if a user's scroll will result in a 1000 px change in scrollTop I'd like to know ahead of time.</p>
  
  <p>The perfect example is iCalendar's control over a user's scroll. No matter how hard you scroll in the iCalendar application, the farthest you can scroll is to the next or previous month.</p>
  
  <p>I currently have a very hackish solution to limit scroll behavior, which only takes into account where the user's scroll currently is.</p>
  
  <pre><code>MyConstructor.prototype._stopScroll = function(){
  
      //Cache the previous scroll position and set a flag that will control
      //whether or not we stop the scroll
      var previous = this._container.scrollTop;
      var flag     = true;
  
      //Add an event listener that stops the scroll if the flag is set to true
      this._container.addEventListener('scroll', function stop(){
          if(flag) {
              this._container.scrollTop = previous;
          }
      }.bind(this), false);
  
      //Return a function that has access to the stop function and can remove it
      //as an event listener
      return function(){
          setTimeout(function(){
              flag = false;
              this._container.removeEventListener('scroll', stop, false);
          }.bind(this), 0);
      }.bind(this);
  };
  </code></pre>
  
  <p>This approach works, and will stop a scroll in progress, but it is not smooth and I'd love to know if there's a better way to accomplish this.</p>
  
  <p>The key to this question is can I know <strong>ahead of time</strong> where a scroll will end up. Thanks!!!</p>