如何判断html页面停止滚动?

写在开始的话

查遍的文献,没有找到js或者jquery定义好的方法可用,最后迫不得已自己写了个方法。(如果哪位同学知道有其他方法,欢迎讨论)

代码

            var count_index = 0;
            $(window).scroll(
                function(e) {
                    if(count_index == 0) {
                        var timeIntervalFunction = setInterval(function() {
                            count_index--;
                            if(count_index <= 0) {
                                console.log("scroll end = " + count_index);
                                clearInterval(timeIntervalFunction);
                                count_index = 0;
                            }
                        }, 300);
                    }
                    count_index++;
                }
            );

效果

如何判断html页面停止滚动?_第1张图片

   
   
   

友情链接:

技术博客        简书主页

转载于:https://www.cnblogs.com/tig666666/p/8523639.html

你可能感兴趣的:(如何判断html页面停止滚动?)