scrooollll direction bla

by lovromar

HTML

<h1>Scroll Here look at consolelog</h1>

CSS

body { height: 2000px; }

JavaScript

$(function(){
      //Keep track of last scroll
      var lastScroll = 0;
      $(window).scroll(function(event){
          //Sets the current scroll position
          var st = $(this).scrollTop();
          //Determines up-or-down scrolling
          if (st > lastScroll){
             console.log("down");
          } 
          else {
           console.log("up");
          }
          //Updates scroll position
          lastScroll = st;
      });
    });