Skip to content

Instantly share code, notes, and snippets.

@farvisun
Forked from toshimaru/jquery-scroll-bottom.js
Created January 17, 2019 19:38
Show Gist options
  • Save farvisun/5e3880c7f8da3078347e79eebc11974c to your computer and use it in GitHub Desktop.
Save farvisun/5e3880c7f8da3078347e79eebc11974c 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