You find the height of the scroll container, and then compare it with the scroll position. If they match, then you have reached the bottom.
<div style="overflow: auto; height: 500px"> </div> $(document).ready(function() { $('div').scroll(function() { var div = $(this); if (div.height() == div.scrollTop() + 1)
Edit: a little testing in the js fiddle, and I realized that the previous version is incorrect. You can use the DOM property to find out how much scrolling is done with a little math with an element height like this.
var div = $(this); if (div[0].scrollHeight - div.scrollTop() == div.height()) { alert('Reached the bottom!'); }
http://jsfiddle.net/Aet2x/1/
Feisty mango
source share