/pure-sticky

Pure js implementation of CSS property position: sticky

Primary LanguageHTMLMozilla Public License 2.0MPL-2.0

Pure Sticky

Pure-Sticky.js is a pure js implementation of the sticky position in CSS. There are zero dependencies needed to use Pure-Sticky.js.

Why?

Mainly because the blink engine (chrome) doesn’t support position: sticky (CSS) out of the box yet. Also, for practice with js.

How?

Demo Page

Before calling the initial function, make sure all of the DOM is ready, see the example source for reference.

For Pure-Sticky to work, the initial function only requires 2 arguments: the element and the position. The element parameter is expecting a string. Make sure for the element that the stringy is an unique id. The position parameter is expecting a int or float, from there the value will be treated as pixels. That’s it.

Support

Browsers tested in:

  • Firefox
  • Chrome
  • Safari
  • Midori

As for IE and Edge, I don’t really develop in Windows, so I haven’t taken the time to see what versions work.

Contributors

OG: Jared Smith @jrods