Skip to content

Instantly share code, notes, and snippets.

@toshimaru
Last active May 31, 2022 10:55
Show Gist options
  • Save toshimaru/6102647 to your computer and use it in GitHub Desktop.
Save toshimaru/6102647 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
}
});
@Manoj-Manjunatha
Copy link

Awesome, thanks. This should be the first result for anyone who is searching for 'detect scroll to botton of page using jquery'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment