title: run jQuery function only ONCE (instead of endless loop when event occur)
body: <p>I have this jQuery code that fires when user scroll down to the point of ad class height (and after). The problem is that I want it to run only ONCE and stop alert. Very simple tweak (and without settimeout nor setting a variable ;)</p>
  
  <p>css:</p>
  
  <pre><code>header{width:100%;height:200px;background:teal;}
  .ad{width:500px;height:120px;margin:0 auto;background:red;}
  article{width:100%;height:1500px;background:yellow;}
  </code></pre>
  
  <p>html:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script src="http://code.jquery.com/jquery-1.8.3.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;header&gt;
      &lt;div class='ad'&gt;&lt;/div&gt;
    &lt;/header&gt;
    &lt;article&gt;&lt;/article&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>jquery :</p>
  
  <pre><code>$(function(){
    $(window).scroll(function(){
      var aTop = $('.ad').height();
      if($(this).scrollTop()&gt;=aTop){
          alert('header just passed.');
      }
    });
  });
  </code></pre>
  
  <p>Thanks !</p>