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();