title: perfomance $(window).scroll vs alternative method to find distance from the top
body: <p>I hear $(window).scroll is bad for performance
  are there any alternative method to find out the position from the top?</p>
  
  <p>For example between these?</p>
  
  <pre><code>$(window).scroll(function() {
  
       if($(this).scrollTop() &gt; 500)   
      {
          $('.class').addClass('class2');
      } else {
          $('.class').removeClass('class2t');
      }
  
  });
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>offset().top
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>.position().top
  </code></pre>
  
  <p>or any other methods? like Pure JavaScript? which one is best/preferred according to modern standards today?</p>