title: How can I make this jQuery listener not fire multiple times?
body: <p>I currently have the following function which effectively retrieves JSON from Django and loads movies via infinite scroll.  However, I find that sometimes this event triggers multiple times, and it ends up getting the same page twice.</p>
  
  <pre><code>$(window).scroll(function() {
    var break_point = $(document).height() - ($(window).height() * 1.02);
    if ($(window).scrollTop() &gt;= break_point) {
      var timePeriod = $('.tab-content').find('.active').attr('id');
      var nextPage = $('#'+timePeriod+' ul li:last').attr('data-next');
      if (nextPage) {
        loadMovies(timePeriod, nextPage);
      }
    }
  });
  </code></pre>
  
  <p>What's the best way to stop this listener from executing multiple times per page?</p>