title: detect scroll to bottom on dynamic page
body: <p>I intend to load extra content on scroll to bottom in a div, but have been so far unable to make the jquery detect scroll to bottom. I know there are many questions here asking the same.. but none of the solutions have worked for me. I clearly have been doing something wrong, but being new at this can't figure out what. here is the code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  
  &lt;script src="jquery-1.10.1.min.js"&gt;
  &lt;/script&gt;
  
  &lt;script&gt;
  $(document).ready(function(){
      var n1=0;
      var n2=5;
      var $win = $(window);   
      $("#page").change(function(){
          var str=$(this).val()
  
          console.log(str);
          if(str.length===0){$("#rssoutput").html("");}
          else
          {$("#rssOutput").load("http://dodomain.uni.me/getrss.php?q="+str+"&amp;n1="+n1+"&amp;n2="+n2);}
  
      });
      $(window).scroll(function() {
          if (document.documentElement.clientHeight + $(document).scrollTop() &gt;= document.body.offsetHeight )
          { 
  
              alert("bottom of the page.");
          }
  
  
      });
  
  });
  
  &lt;/script&gt;
  
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;form&gt;
  &lt;select id="page"&gt;
  &lt;option value=""&gt;Select an RSS-feed:&lt;/option&gt;
  &lt;option value="Google"&gt;Google News&lt;/option&gt;
  &lt;option value="cyanide"&gt;cyanide and happiness&lt;/option&gt;
  &lt;option value="oglaf"&gt;Oglaf&lt;/option&gt;
  &lt;option value="xkcd"&gt;xkcd&lt;/option&gt;
  &lt;option value="wired"&gt;wired.com&lt;/option&gt;
  &lt;/select&gt;
  &lt;/form&gt;
  &lt;br&gt;
  &lt;div id="rssOutput" &gt;RSS-feed will be listed here...&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I probably provided more code than needed.. but I'm unsure if the problem is elsewhere. The php just sends generates some html off rss feeds . Its online here <a href="http://dodomain.uni.me/rss.html" rel="nofollow">http://dodomain.uni.me/rss.html</a></p>
  
  <p>Edit: the code works when the contents of the div is static (ie not loaded via ajax) as demonstrated here <a href="http://jsfiddle.net/jkh5P/" rel="nofollow">http://jsfiddle.net/jkh5P/</a></p>