title: jQuery add class when scroll down and remove when scroll up
body: <p>So I have this bit of code to turn some lights on when scroll is past a 1000px and if the scroll back up it turns the lights off again, This is done by just adding a class and removing the class..</p>
  
  <pre><code>var lights = jQuery('.scene2 .lights');
  jQuery(function () {
      lights.data('switch', 'on');
  });
  jQuery(window).scroll(function () {
      if (jQuery(document).scrollTop() &gt; 1000) {
          if (jQuery(lights).data('switch') == 'on') {
              jQuery(lights).data('switch', 'off');
              jQuery(lights).stop().removeClass('lightsOff');
              jQuery(lights).stop().addClass('lightsOn');
          }
      } else {
          if (jQuery(lights).data('switch') == 'off') {
              jQuery(lights).data('switch', 'on');
              jQuery(lights).stop().removeClass('lightsOn');
              jQuery(lights).stop().addClass('lightsOff');
          }
      }
  });
  </code></pre>
  
  <p>but I need to do this multiple times &amp; its just alot of code, I was wondering if there is a shorter way of doing this? </p>