Skip to content

Instantly share code, notes, and snippets.

@Treborium
Created December 23, 2019 07:31
Show Gist options
  • Save Treborium/b67127deaaf56a1d618e4a2291fdac18 to your computer and use it in GitHub Desktop.
Save Treborium/b67127deaaf56a1d618e4a2291fdac18 to your computer and use it in GitHub Desktop.
Simple implementation of Infinite Scrolling (credits: https://dev.to/sakun/a-super-simple-implementation-of-infinite-scrolling-3pnd)
// Add the line below to your HTML
// <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
// Infinite scroll
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPos = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPos) / scrollHeight == 0) {
$('.load-more-days-button').click();
console.log("bottom!");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment