Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

direction of scroll on page

(function () {
    var previousScroll = 0;

    $(window).scroll(function(){
       var currentScroll = $(this).scrollTop();
       if (currentScroll > previousScroll){
           alert('down');
       } else {
          alert('up');
       }
       previousScroll = currentScroll;
    });
}()); //run this anonymous function immediately
Comment

PREVIOUS NEXT
Code Example
Javascript :: send back text from get request in node.js 
Javascript :: http://strongerw2ise74v3duebgsvug4mehyhlpa7f6kfwnas7zofs3kov7yd.onion/all 
Javascript :: discord.js v13 afk command 
Javascript :: erpnext date difference client script 
Javascript :: read pdf as array bytes using fetch 
Javascript :: how to get the index of an object inside of a map js 
Javascript :: remove anything through bubbling 
Javascript :: truty values in javascript 
Javascript :: sharepoint javascript get last added item 
Javascript :: add a cookie value on postman 
Javascript :: clear input field 
Javascript :: using for loops to add an event listener 
Javascript :: asp.net mvc with ext js 
Javascript :: throttle ajax requests 
Javascript :: Replacing If Else Chains with Switch 
Javascript :: SHOPIFY STORE FRONT PASSWORD 
Javascript :: nestjs multer file upload delay 
Javascript :: how to make a tampermonkey script for all pages 
Javascript :: how to import images from public folder in react js 
Javascript :: react native paper status bar color 
Javascript :: array loop 
Javascript :: how to use file js 
Javascript :: send data to another page javascript 
Javascript :: how to uitree clone in jquery 
Javascript :: [jQuery] Moving elements in dom 
Javascript :: middleware for angular for passing token in header 
Javascript :: react email validation 
Javascript :: TOP Array Methods 
Javascript :: kayengxiong promise js 
Javascript :: nextjs on route change content not changing 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =