jquery-stickem
v1.0.3
Published
Packaging the great jquery-stickem code into an NPM module so people can find it with Yarn
Downloads
32
Readme
Make items sticky as you scroll, to a point. (See Demo)
Usage
Defaults
item: '.stickem' Items that you want to stick on scroll.
container: '.stickem-container' Container that you want the sticky item to be contained in.
stickClass: 'stickit' Class added to the sticky item once it should start being sticky.
endStickClass: 'stickit-end' Class added to the sticky item once it has reached the end of the container
offset: 0 Do you already have a fixed horizontal header on the page? Offset stick 'em by that many pixels.
start: 0 If your sticky item isn't at the top of the container, tell it where it should start being sticky.
onStick: null You can create a callback function that fires when an item gets "stuck". The item gets passed back.
onUnstick: null You can create a callback function that fires when an item gets "un-stuck". The item gets passed back.
Destroying
If you have a bunch of stuff that happens after your page has loaded (e.g. AJAX requests) that changes the height of your containers and page, and you need to "destroy" stick 'em, do it like this:
Then you can re-instantiate again if you need to.