Search code examples
loopsscrollinfinitecontinuous

Continuous Looping Page (Not Infinite Scroll)


I'm looking for resources that create scrolling functions like the ones found on these sites:
Outpost Journal
Unfold

Once the scroll bar hits the bottom of the page, I want it to loop back to the top. I'm familiar with with the infinite scroll, and this is not what I want. I've also found scripts that will write/add the same content to the bottom of the page, but none that loop back to the top of the page.


Solution

  • Try this:

       $('document').ready(function() {
                 $(document).scroll(function(){
                 if(document.documentElement.clientHeight + 
                 $(document).scrollTop() >= document.body.offsetHeight )$(document).scrollTop(0);
                 });
              });