Posted inJavaScript / jQuery

onscroll jquery – jquery on scroll event Example

onscroll jquery A scroll event is sent whenever the element’s scroll position changes, regardless of the cause.

onscroll jquery

The event is triggered when the user moves the scrollbar up or down. jQuery scroll() function triggers when the element is scrolled.

Syntax of jquery on scroll

Trigger the scroll event for the selected elements:


Attach a function to the scroll event:


jquery on scroll down

Check current scrollTop vs previous scrollTop

var endScrlTp = 0;
   var st = $(this).scrollTop();
   if (st > endScrlTp){
       // downscroll source code
   } else {
      // upscroll source code
   endScrlTp = st;

jQuery scroll() method



Welcome To :):)

Scroll the bordered text to see the effect.

This is an example of using the scroll() method. website focuses on all web language and framework tutorial PHP, Laravel, Codeigniter, Nodejs, API, MySQL, AJAX, jQuery, JavaScript, Demo.

Don’t Miss : Add Class On Scroll Jquery

I hope you get an idea about onscroll jquery.
I would like to have feedback on my
Your valuable feedback, question, or comments about this Article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype