I am trying to repeat an animation where a page automatically scrolls to the bottom. When it reaches the bottom I want it to then scroll to the top. Then, repeat forever. However, I can't get it to even perform the first callback. Any help would be greatly appreciated.
Code:
pageScroll(pageScrollUp);
function pageScroll(callback) {
window.scrollBy(0,1); // horizontal and vertical scroll increments
scrolldelay = setTimeout('pageScroll()',50); // scrolls every 100 milliseconds
callback(pageScroll);
}
function pageScrollUp(callback) {
window.scrollBy(0,-1); // horizontal and vertical scroll increments
scrolldelay = setTimeout('pageScroll()',50); // scrolls every 100 milliseconds
callback(pageScrollUp);
}
Thanks Josh