Is there a way for JS to detect that the bottom of a div has been reached, rather than the bottom of a page?
<p>I'm using this at the moment:</p>

<pre><code>$(window).scroll(function() {
   if($(window).scrollTop() + $(window).height() == $(document).height()) {
      $(".initial").delay(2000).fadeOut("slow", function() {
          $(".secondary").fadeIn("slow");
      });
    }
});
</code></pre>

<p>And I've tried fiddling around with <code>window</code> and replacing it with div names and static pixel values for the scroll to no avail.</p>
