title: Detect if a scroll event is triggered manually in jQuery
body: <p>This question was already asked here a long time ago:</p>
  
  <p><a href="https://stackoverflow.com/q/11049287/2592207">Detect jquery event trigger by user or call by code</a>  </p>
  
  <p>But it has never been answered conclusively (or maybe I'm simply not able to search properly).</p>
  
  <p>Is it possible to detect whether a <code>scroll</code> event has been triggered by the user or by the jQuery <code>animate</code> function?</p>
  
  <p>I am trying to prevent the <code>scroll</code> event to trigger itself while doing something like this:</p>
  
  <pre><code>$(document).scroll(function(){
      $("html").stop(true);
      var number = 400; //some other stuff is happening here
      clearTimeout(tout);
      tout = setTimeout(function(){
          if(top == $(document).scrollTop()){
              $("html").animate({
                  scrollTop: (number),
                  easing: "easeInQuad",
                  duration: 110
              });
          }
      },120);
  });
  </code></pre>
  
  <p>This code seems to be suitable:</p>
  
  <pre><code>$('#scroller').scroll(function(e) {
      if (e.originalEvent) {
          console.log('scroll happen manual scroll');
      } else {
          console.log('scroll happen by call');
      }
  });
  </code></pre>
  
  <p>But the <code>originalEvent</code> object isn't able to detect the animate trigger properly.</p>
  
  <p>Is there any other way to do this?</p>