Answers for "call a function on scroll down of document in jquery"

1

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;
});
Posted by: Guest on December-05-2020
1

jquery on scroll

Syntax
Trigger the scroll event for the selected elements:
$(selector).scroll()

Attach a function to the scroll event:
$(selector).scroll(function)
Posted by: Guest on June-25-2020

Code answers related to "call a function on scroll down of document in jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language