Skip to content

Instantly share code, notes, and snippets.

@unknownuser88
Created January 6, 2014 15:37
Show Gist options
  • Save unknownuser88/8284556 to your computer and use it in GitHub Desktop.
Save unknownuser88/8284556 to your computer and use it in GitHub Desktop.
JQUERY CHECK IF DIV SCROLLED TO END
$(document).ready(function(){
$('div').bind('scroll',chk_scroll);
});
function chk_scroll(e)
{
var elem = $(e.currentTarget);
if (elem[0].scrollHeight - elem.scrollTop() == elem.outerHeight())
{
console.log("bottom");
}
}
Other ways:
//scrollTop refers to the top of the scroll position, which will be scrollHeight - offsetHeight
if( obj.scrollTop == (obj.scrollHeight - obj.offsetHeight)) { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment