首页 > 代码库 > js scroll 滚动连续多次触发事件只执行一次

js scroll 滚动连续多次触发事件只执行一次

(function() {
    var finished = true;
    function loadData() {
        //xxxx
        finished = true;
    }
    dom.onscroll = function() {
        if(finished && this.scrollHeight - this.clientHeight == this.scrollTop) {
            finished = false;
            loadData();
        }
    }
})();

 

js scroll 滚动连续多次触发事件只执行一次