Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery on scroll down

Check current scrollTop vs previous scrollTop

var lastScrollTop = 0;
$(window).scroll(function(event){
   var st = $(this).scrollTop();
   if (st > lastScrollTop){
       // downscroll code
   } else {
      // upscroll code
   }
   lastScrollTop = st;
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: first remove active class from classlist and append to current element using javascript 
Javascript :: get specific item from local storage 
Javascript :: js revers string fucntion 
Javascript :: Generating a seed file in sequelize 
Javascript :: readfilesync 
Javascript :: how to get the sum of a column in sequelize 
Javascript :: make created element brighter 
Javascript :: __dirname go back one directory 
Javascript :: load js after ajax 
Javascript :: send form data with file upload using ajax 
Javascript :: get how much i scroll in jquery 
Javascript :: js nullish 
Javascript :: drm react native 
Javascript :: button disabled angular 
Javascript :: javascript get index of object in array 
Javascript :: vanilla javascript set display 
Javascript :: bootstrap js link not working 
Javascript :: add download buttons in datatable 
Javascript :: npm ERR! code ELIFECYCLE npm ERR! errno 1 
Javascript :: phone number formatter javascript grepper 
Javascript :: javascript get diagonals of array 
Javascript :: axios header accept language 
Javascript :: eslint ignore current line 
Javascript :: jquery get date from datepicker 
Javascript :: tomodachi 
Javascript :: how to check if you click something in javascript 
Javascript :: javascript get random string char 
Javascript :: js alert yes no 
Javascript :: node mon in loopback 
Javascript :: transpose an array in javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =