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

stucky

v1.0.4

Published

A sticky table header utility that just works

Downloads

9

Readme

Stucky - sticky table headers

This is a pretty simple to use sticky table headers implementation. Not a ton of features, but who needs them anyways.

Oh, and a nice bonus is that it doesn't require jQuery!

Features

Once initialized, your tables should hopefully get awesome sticky headers.

  • If you have a <thead />, you'll get a horizontal sticky header row
  • If you have <th />s inside your <tbody> tag, you'll get a vertical sticky header row.
  • If you have both - well, god darn it, you'll get all the stickies.

Browser compatibility

Tested and working in latest evergreen browsers, on both desktop and phones, as well as IE 9 or newer. Note that in order for IE9 to work, you need a classList polyfill. The demo.js also uses babel-polyfill, which adds some ES5 methods.

Installation

The package is available via NPM:

$ npm install --save stucky

If you don't believe in package managers, you can grab either the uncompressed or the minified version.

Usage

I like stuff to be simple to use. When the DOM is loaded, simply add this:

// Import the scripts
import Stucky from 'stucky';

// Select the tables you want to have sticky headers
const $tables = [...document.querySelectorAll('table')];

// Set up options
const opts = {
    // If you have a fixed header, this px value will let you account for it
    topMargin: 0,
    // Remove the header this px value before the end of the table
    allowance: 0,
    // Space separated class names to apply to the table wrapper
    wrapperClasses: ''
};

// Initiate them
$tables.forEach($table => new Stucky($table, opts));

A note about styles

There are some styles that are required for this to work. You'll find it here - but it's also included in the NPM package if you want to use it directly. Just make sure they are included somehow!

Open open source

We :heart: pull requests! If you want to help out, feel free to create an issue, or even better - create a pull request to go with it. If I like your work, I'll make sure to make you a contributor :)

Development

If you'd like to submit a pull request or fork this project, I've already set up some basic build tasks:

$ npm run build     # Build the project
$ npm start         # Start a dev server and open the demo page in a new tab