title: jQuery: Scroll events and one()
body: <p>I have a few conditional events depending on scroll position of a page. Everything works swell, except the last event that I need to fire <strong>only once</strong>. Here is my code:</p>
  
  <pre><code>function curScroll() {      
      var scrollX = $(window).scrollTop();
      var pointA = $('#pointA').offset().top;
      var pointB = $('#pointB').offset().top;
  
      if (scrollX &lt; pointA) {
          $('#something').removeClass('middle').addClass('top');  
      } else if ((scrollX &gt;= pointA) &amp;&amp; (scrollX &lt; pointB)) {
          $('#something').addClass('middle').removeClass('top');
      } else if (scrollX &gt;= pointB) {
          $('#something').removeClass('middle top');
          // DO SOMETHING JUST ONCE, NOT EVERY TIME USER SCROLLS TO THE POINT
      }
  }
  </code></pre>
  
  <p>I assume the one() function is the way. The problem is the required "event" parameter. </p>
  
  <p>So should I attach custom trigger() that fires each time user scrolls to pointB? Is there another way?</p>
  
  <p>Thank you for your ideas!</p>