jQuery判断页面滚动条滚动方向

废话不多说,直接上代码

$(window).scroll(function(){
                var before = $(window).scrollTop();
                $(window).scroll(function() {
                    var after = $(window).scrollTop();
                    if (before<after) {
                        console.log('上');
                        before = after;
                    };
                    if (before>after) {
                        console.log('下');
                        before = after;
                    };
                });
            });

  

posted @ 2016-09-22 15:08  yuan_00  阅读(10709)  评论(1编辑  收藏  举报