title: Can you override an "onscroll" listener by using another?
body: <p>I'm working on a problem where I want to override the global onscroll event listener with one specifically assigned to an element.</p>
  
  <p>Here is an example.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("a").on('click', function(){
    console.log('Clicked');
    $('html,body').animate({scrollTop:50}, 1000);
    var count = 0;
    $(window).on('scroll', function(){
      if(count &lt; 5)
      {
        console.log('Scrolling via link...'); 
      }
      count++;
    });
  });
  
  var globalCount = 0;
  $(window).on('scroll', function(){
    if(globalCount &lt; 5)
    {
      console.log('Scrolling...');
    }
    globalCount++;
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body{min-height:2000px;}</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;a href="#"&gt;Link&lt;/a&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>How do I <strong>prevent</strong> the <em>console.log('Scrolling...')</em> from running?</p>