title: Repeatedly adding/removing class will slow things down?
body: <p>So I want to do a couple of things on scroll with jQuery...</p>
  
  <pre><code>$(window).scroll(function() {
    //so it's not overly aggressive calling the funciton
    setTimeout(function(){check_scroll()}, 50);
  }); 
  </code></pre>
  
  <p>And then...</p>
  
  <pre><code>function check_scroll(){
    var scroll = $(window).scrollTop()
    if(scroll &gt; 100) {
      $("#fixed").addClass("fixed");
    }
    else
      $("#fixed").removeClass("fixed");  
  };
  </code></pre>
  
  <p>So, my question is, #fixed will have the class ".fixed" most of the time, so if I repeatedly ask jQuery to add it, will it be non-performant? Should I first check if it has the class and then try to add it?</p>
  
  <p>It seems fine as it is now, but my app will grow and there will be a lot of js going on, so I want to milk every bit of performance possible.</p>