title: if ($(window).scrollTop() == $(document).height() - $(window).height() - 300) Why this not work?
body: <p>I have problem with my infinite scroll. I want execute load more before 300px of the bottom of the page. </p>
  
  <p>I detect the scroll with :</p>
  
  <pre><code>$window.scroll(function(){
  </code></pre>
  
  <p>And in this function I have test this :</p>
  
  <pre><code>if (($document.height() - $window.height()) == $window.scrollTop()) {
  </code></pre>
  
  <p>But this works only when we are at footer.</p>
  
  <p>Then I test this :</p>
  
  <pre><code>if ($(window).scrollTop() &gt;= $(document).height() - $(window).height() - 300)
  </code></pre>
  
  <p>But the infinite scroll run several times between 300px and the bottom of the page. </p>
  
  <p>After this, I want just test this : </p>
  
  <pre><code>if ($(window).scrollTop() == $(document).height() - $(window).height() - 300)
  </code></pre>
  
  <p>But this not working and I don't understand. 
  Do you have ideas ? </p>
  
  <p>Thanks you so much</p>