title: Reducing lag on scroll event
body: <p>This is my current code: <a href="http://jsfiddle.net/spadez/9sLGe/3/" rel="nofollow">http://jsfiddle.net/spadez/9sLGe/3/</a></p>
  
  <p>I am concerned that it will be very laggy doing this because it's monitoring <code>scroll</code>. I saw mention on my other question of debouncing a bit like this:</p>
  
  <pre><code>var scrollTimeout,
      callback = function () {  
          /// Do your things here
      };
  
  $(window).scroll(function () {
  
      if (scrollTimeout)
          clearTimeout(scrollTimeout);
  
      scrollTimeout = setTimeout(callback, 40);
  
  });
  </code></pre>
  
  <p>Can anyone tell me if this is a good idea and how it might be integrated.</p>
  
  <p>James</p>