Stickyfill
position: sticky
polyfill
Deprecated!
Stickyfill did a good job while the browsers were implementing
Stickyfill did a good job while the browsers were implementing
position: sticky
support. Now you can safely use stickies without a polyfill, all modern browsers support them.
Sticky is a block that sticks to the edge of the screen when you scroll past its top border. And when it reaches the bottom of the parent element – goes along with it. Just like this paragraph.
The code is pretty simple:
.sticky {
position: -webkit-sticky;
position: sticky;
top: 0;
}
top
changes sticky’s position relatively to the edge of the viewport. You may also specify margin-bottom
to alter sticky’s bottom limit a bit.
The problem is, stickies are currently supported only in Safari on OS X and iOS.
So I made Stickyfill. It emulates stickies where they aren’t supported natively.
What it does:
- Supports top-positioned stickies
Supports table cell stickiesDisabled until Firefox makes a native implementation- Works in IE9+
- Disables in older browsers and in browsers with native sticky support
- Mimics the original sticky behavior (where it can)
- Considers a whole lot of different use cases
What it doesn’t do:
- Doesn’t support left, right, bottom or combined stickies
- Doesn’t support stacking of table cell stickies
- Doesn’t work in overflowed blocks
- Doesn’t parse your CSS (launch it manually)