Created
June 13, 2022 21:07
-
-
Save yarliganfatih/2ad1f6f5f5baae451ffa99352bd3a138 to your computer and use it in GitHub Desktop.
Auto Scroll Infinity Loop
This file contains 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
function scrollLoop(delay=5000){ // delay for a animation duration | |
$('html, body').on('down', function () { | |
$(this).animate({ scrollTop: $(document).height() - $(window).height() }, delay); | |
$(this).trigger('up'); | |
}); | |
$('html, body').on('up', function () { | |
$(this).animate({ scrollTop: 0 }, delay); | |
$(this).trigger('down'); | |
}); | |
$('html, body').trigger('down'); // start with scroll down | |
} | |
scrollLoop(3000); // call Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment