title: How to prevent executing window.onpopstate function while window.scroll event using jquery
body: <p>The scenario is when I scroll in browser it executes </p>
  
  <pre><code>$(window).scroll(function() { ...  }
  </code></pre>
  
  <p>but in same page I have onpopstate function which usually executes when I press back/forward button in browser</p>
  
  <pre><code>window.onpopstate = function(event) { ...  }
  </code></pre>
  
  <p>Here is my complete script on html page</p>
  
  <pre><code>&lt;script&gt;
      window.onpopstate = function(event) { ...  }
  
      $( document ).ready(function() {
          $(window).scroll(function() { ...  }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Issue is when I scroll in browser it executes <code>$(window).scroll</code> as well as <code>window.onpopstate</code> both the events. </p>
  
  <p>Can anyone help me out here, as how do I prevent executing <code>window.onpopstate</code> event while scrolling.</p>