npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stickyfill2

v2.0.1

Published

This is fork repository of [stickyfill](https://github.com/wilddeer/stickyfill) originally created by [wilddeer](https://github.com/wilddeer/).

Downloads

142

Readme

This is fork repository of stickyfill originally created by wilddeer.


#position: sticky polyfill

The most accurate sticky polyfill out in the wild.

Check out the demo and use cases test page.

###What it does

  • supports top-positioned stickies,

  • works in IE9+,

  • disables in older IEs and in browsers with native position: sticky support.

  • Mimics original position: sticky behavior:

    • uses parent node as a boundary box,
    • behaves nicely with horizontal page scrolling,
    • only works on elements with specified top,
    • mimics native top and margin-bottom behavior,
    • ~~works with table cells~~ disabled until Firefox makes a native implementation

###What it doesn't

  • doesn't support left, right, bottom or combined stickies,
  • doesn't work in overflowed blocks,
  • doesn't parse your CSS! Launch it manually.

###Installation

Download:

Include it on your page:

<script src="path/to/stickyfill.js"></script>

Also available in Bower:

bower install Stickyfill --save

###Usage

JS:

var stickyElements = document.getElementsByClassName('sticky');

for (var i = stickyElements.length - 1; i >= 0; i--) {
    Stickyfill.add(stickyElements[i]);
}

or JS + jQuery:

$('.sticky').Stickyfill();

CSS:

.sticky {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
}

Also worth having a clearfix:

.sticky:before,
.sticky:after {
    content: '';
    display: table;
}

###Pro tips

  • top specifies sticky's position relatively to the top edge of the viewport. It accepts negative values, too.
  • Despite common misconception, sticky's bottom limit is defined by its parent node's bottom boundary. It has nothing to do with offsetParent (closest relatively positioned parent).
  • You can push sticky's bottom limit up or down by specifying margin-bottom.
  • Any non-default value (not visible) for overflow, overflow-x, or overflow-y on any of the predecessor elements anchors the sticky to the overflow context of that predecessor. Simply speaking, scrolling the predecessor will cause the sticky to stick, scrolling the window will not. This is expected with overflow: auto and overflow: scroll, but often causes problems and confusion with overflow: hidden. Keep this in mind, folks!

Check out the test page to understand stickies better.

###API

####Stickyfill.add(HTMLNode)

Add new sticky and init(), if necessary.

####Stickyfill.remove(HTMLNode)

Remove sticky.

####Stickyfill.rebuild()

Recalc all metrics and update stickies' positions.

Call it after layout changes. Launches automatically after window resizes and device orientations changes.

####Stickyfill.pause()

Remove event listeners.

Usefull for debugging. Use Stickyfill.init() to get stuff running again.

####Stickyfill.stop()

Disable stickies.

Use Stickyfill.init() to enable them again.

####Stickyfill.kill()

Disable stickies and erase Stickyfill.stickies.

####Stickyfill.init()

Attach event listeners and start watching for stickies in Stickyfill.stickies.

####Stickyfill.stickies

Array of parametric objects for all added stickies.

###Using Stickyfill?

Be sure to drop me a link → :envelope: [email protected]. Wanna see it in action.

###License

MIT license.