Skip to content

Instantly share code, notes, and snippets.

@donohoe
Created July 20, 2012 12:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donohoe/3150544 to your computer and use it in GitHub Desktop.
Save donohoe/3150544 to your computer and use it in GitHub Desktop.
Determine when you have scrolled to the end of an element
document.getElementById('items').addEventListener('scroll', function() {
var seekEl = document.getElementById("items");
var contentHeight = seekEl.scrollHeight - seekEl.offsetHeight;
if (contentHeight <= seekEl.scrollTop) {
console.log("Scroll end");
}
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment