Add class to the element on scroll

Marko Krstić
18 Feb 2022
    if ($(this).scrollTop() > 100) {
    } else {

Change element class or ID on lines 3 and 5 to trigger right elements and on line 2 100 is how many pixels to scroll until class is added.

Was this article helpful?



Never miss new post again

Subscribe and get list of new posts in your inbox

Click to Copy