continuos scrollling js

Solutions on MaxInterview for continuos scrollling js by the best coders in the world

showing results for - "continuos scrollling js"
Martin
29 Apr 2020
1var scrollDirection = 10;
2function pageScroll() {
3    window.scrollBy(0,scrollDirection); // horizontal and vertical scroll increments
4    scrolldelay = setTimeout('pageScroll()',5); // scrolls every 50 milliseconds
5    if ( (window.scrollY === 0) || (window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
6        scrollDirection = -1*scrollDirection;
7    }
8}
9pageScroll();