Shaare your links…
408 links
Liens · Devenet Home Login RSS feed Tags cloud
  • [JavaScript] detect down/up scrolling - Le Hollandais Volant → http://lehollandaisvolant.net/?mode=links
    // Initial state
    var scrollPos = 0;
    // adding scroll event
    window.addEventListener('scroll', function(){ scrolling() });

    // the function : compares the "new" scrolling state with the previous
    // (this allows detecting either "up" or "down" scrolling)
    // then saves the new in the $previous for the next iteration.

    function scrolling() {
    if ((document.body.getBoundingClientRect()).top > scrollPos) {
    console.log('scrolling DOWN');
    } else {
    console.log('scrolling UP');
    }
    scrollPos = (document.body.getBoundingClientRect()).top;
    }
    Wed Feb 24 23:07:05 2016 – #permalink
    javascript
Shaarli by sebsauvage
Shaarli-Theme by Nicolas based on idleman theme