showing results for - "detect scroll javascript number vertical"
Sirine
27 Feb 2016
1var lastScrollTop = 0;
2
3// element should be replaced with the actual target element on which you have applied scroll, use window in case of no target element.
4element.addEventListener("scroll", function(){ // or window.addEventListener("scroll"....
5   var st = window.pageYOffset || document.documentElement.scrollTop; // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
6   if (st > lastScrollTop){
7      // downscroll code
8   } else {
9      // upscroll code
10   }
11   lastScrollTop = st <= 0 ? 0 : st; // For Mobile or negative scrolling
12}, false);
13
queries leading to this page
event listener scroll up javascriptdetect vertical scroll javascriptscroll up jsscroll detection scroll down and up javascriptscroll down jsif user is scrolling up javascriptscroll down or up jsjs eventlistener scroll directionjs scroll uphow to scroll down in jshow to scroll down page in jsangular get scroll directionjs scroll up and then downes6 detect scrollscroll up window jsdetect scroll direction jsjs event listener scroll directionjs scroll event directionhow to scroll up in jsadd veentlistener scroll down on clickcheck scroll up jsjavascript detect when user scroll downimplement scroll directionhow to scroll down with javascriptjavascript scroll up and down eventjavascript if scroll upjs get scroll event directionjs scroll up downscroll down with javascriptup scroll event javascriptget scroll direction javascriptjs detect scroll directiondetect scroll direction javascripton scrollup javascriptjs up and down scrolljs scrool upjs scroll down pagejavascript on scroll downhow to find downscroll event javascriptjs scroll down or upjavascript scroll directionscroll down page jsjavascript how to scroll uphow to know scrolldirection jsdetermine scroll up or down jsjs scroll up and down eventhow to scroll down jsjs scroll up codedetect scroll up in jsscroll up and down javascriptscroll down page in jsdetermine scroll direction javascriptscroll event direction javascriptjs know when you scrolljavascript scroll to downhow to detect scroll up in javascriptscroll down javascriptscroll down in jsscroll direction javascriptjs check if user scrolling up or down on mobileonscroll down window offsetjavascript detect scroll uphow to detect scroll up and scroll down in javascriptjs check if user is scrolling up or downjavascript get scroll directiondetecting scroll directionscroll up and scroll down event in javascriptjavascript scroll element downcheck scroll down and up jshow to detect direction of scrolljs screen scroll upjavascript event scroll up downscroll down using jsdetect scroll up and down javascriptscroll down page javascripthandling scroll up and downscroll up scroll down jsscroll down with jsscroll up javascriptevent scroll down and up jsscroll direction jshow to detect scroll direction in javascriptjs get page scroll directionevent handling when scroll in x directionscroll down using javascriptangular detect scroll directionscroll up or scroll down in jshow to know scroll direction javascripthow to check scroll up or down javascripton scroll up javascriptscroll up in jsjavascript if scrolling downjs to scroll downhow to scroll up by jsjs scroll downjs on scroll downhow to know window in scroll up or down javascriptvanilla js check scroll directionjs check scrolling directionvanilla js detect scroll directiondetect scroll down jsscroll down page jsjavascript scoll down or upevent listener for scroll down vs scroll upjavascript scroll up and downdetect scroll directionjavascript detect scroll directiones6 detect scroll inside a divscroll up event javascriptjs get scroll directionsroll down using jsscroll object directionjavascript to scroll downfind scroll direction javascriptscroll down and scroll up event in javascripthow to scroll up in javascriptjs scroll which directionjs scroll up or downhow to up to down scroll method javascriptjavascrip detect whn i am scrolling up or downscroll up down jshow to check with javascript scrolling uponscroll down and uposcroll up and down in javascripthow to detect if user scrolls down javascriptdetect scroll up using javascri 5btscroll up in javascriptjavascript scroll down or upcheck down scroll javascriptjavascript scroll event directionhow to detect scroll direction without scrolltopscroll down up jsscroll up scroll down javascriptjavascript scroll down pagehow to scroll down with jsjavascript scroll down upalert if scroll direction is downevent listener for scroll down and scroll uphow to scroll down in javascriptjavascript scroll upjs check scroll abovejavascript on scroll uphow to determine which way user scrolledjs if scroll direction change not scrollingjs check if scroll up or downjavascript scroll page up and downdetect scroll javascript number vertical