Skip to content

Instantly share code, notes, and snippets.

@Sanabria
Forked from toshimaru/jquery-scroll-bottom.js
Created August 12, 2016 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sanabria/660e32d7065515df7a92e1374e97538d to your computer and use it in GitHub Desktop.
Save Sanabria/660e32d7065515df7a92e1374e97538d to your computer and use it in GitHub Desktop.
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment