Quantcast
Channel: jQuery By Example
Viewing all articles
Browse latest Browse all 248

Detect Scroll Position (Up/Down) using jQuery

$
0
0
Below jQuery code detects whether user is scrolling up or down in the webpage.
var iScrollPos = 0;

$(window).scroll(function () {
    var iCurScrollPos = $(this).scrollTop();
    if (iCurScrollPos > iScrollPos) {
        //Scrolling Down
    } else {
       //Scrolling Up
    }
    iScrollPos = iCurScrollPos;
});
Feel free to contact me for any help related to jQuery, I will gladly help you.

Viewing all articles
Browse latest Browse all 248

Trending Articles