Stikcybits

stickybits

Alternative to position: sticky polyfills.

  • Aprox ~2KB of javascript that would help us to know when a DOM element is stuck (position:sticky).

  • It can add a CSS Sticky Class .js-is-sticky when position: sticky elements become active and a CSS Stuck Class .js-is-stuck when they become stuck.

  • Loosely mimics position: sticky to consistently stick elements vertically across multiple platforms.

Get it: npm install stickybits

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
12
 stickybits('selector', options);

 /*
Options:

    - target = el (DOM element)
    - offset = 0 || 'dealer's choice'
    - verticalPosition = top || bottom
    - useStickyClasses = true || false
    - elStyles = CSS Styles
    - positionVal = fixed || sticky
 */

GIF FTW!

stickybits.gif

Suggest a module

Comments