Pure-Sticky.js is a pure js implementation of the sticky position in CSS. There are zero dependencies needed to use Pure-Sticky.js.
Mainly because the blink engine (chrome) doesn’t support position: sticky (CSS) out of the box yet. Also, for practice with js.
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.
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.
OG: Jared Smith @jrods