🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

sticky.js is a super tiny jQuery plugin that adds a custom CSS class to DOM element when you scroll past a certain amount of pixels from the top of the webpage.

scrolling scroll-effect

Documentation

sticky.js

Super small (just 0.1KB) jQuery plugin to add a class when scrolling past a certain point.

Installation

<script src="sticky.min.js"></script>

Usage

Add the class my-class to the element with id my-element when the visitor scrolls past 50px from the page top. The class will automatically be removed when scrolling back past the trigger.

$('#my-element').sticky(50, 'my-class');

Same as above, but triggered when the element is about to be scrolled past.

var elementY = $('#my-element').offset().top; $('#my-element').sticky(elementY, 'my-class');

You May Also Like