寻找薛定谔的猫

导航

 
 1 var scrolltop = new Array();
 2 var index = 0;
 3 scrolltop[0] = 0;
 4 $(document).scroll(function(){
 5      index ++;
 6      scrolltop[index] = $(document).scrollTop();
 7      if (scrolltop[index] > scrolltop[index-1]) {
 8             console.log("scroll down");
 9      }else{
10             console.log("scroll up");
11      };
12 })

 

posted on 2018-11-13 10:25  teagueli  阅读(994)  评论(1编辑  收藏  举报