Infinite continuous looping scroll on mobile

I have a small problem with my looping scroll. It works pretty well on larger displays, but on handheld devices it glitches quite a lot. I’m not sure where I’m doing something wrong or where I should adjust the code to work on mobile as well.

Link to site: https://studio-6-9ede0f.webflow.io/

Here’s what I got so far:

var origDivHeight = document.querySelector(".infinite").offsetHeight;

var clone=$(".infinite").contents().clone();
clone.appendTo(".infinite");
clone.prependTo(".infinite");

$(document).scroll(function(){ 

    var scrollWindowPos = $(document).scrollTop(); 

    if(scrollWindowPos >= origDivHeight ) { 
        $(document).scrollTop(0); 
    }
    if(scrollWindowPos <= 0 ) { 
         $(document).scrollTop(origDivHeight); 
    }

});

window.scrollBy(0, 1);
window.scrollBy(0, -1);

71 thoughts on “Infinite continuous looping scroll on mobile”

  1. What i don’t understood is in fact how you are now not really much more neatly-favored than you may be
    now. You are very intelligent. You recognize therefore significantly relating to this topic,
    produced me individually imagine it from numerous
    numerous angles. Its like women and men are not interested except it is something to do with Woman gaga!
    Your personal stuffs nice. At all times deal with
    it up! http://www.deinformedvoters.org/hydroxychloroquine

    Reply

Leave a Comment