Created
December 23, 2019 07:31
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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