📜  连续滚动 js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:38.244000             🧑  作者: Mango

代码示例1
var scrollDirection = 10;
function pageScroll() {
    window.scrollBy(0,scrollDirection); // horizontal and vertical scroll increments
    scrolldelay = setTimeout('pageScroll()',5); // scrolls every 50 milliseconds
    if ( (window.scrollY === 0) || (window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
        scrollDirection = -1*scrollDirection;
    }
}
pageScroll();