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

sticky-footer

v4.2.0

Published

Responsive sticky footers

Downloads

157

Readme

Sticky Footer Build Status

Responsive sticky footers that adjust dynamically as the screen size changes.

Download Sticky Footer / View the demo

Want to learn how to write your own vanilla JS plugins? Check out "The Vanilla JS Guidebook" and level-up as a web developer. 🚀

Getting Started

Compiled and production-ready code can be found in the dist directory. The src directory contains development code.

1. Include Sticky Footer on your site.

<script src="dist/js/sticky-footer.js"></script>

2. Add the markup to your HTML.

<div data-sticky-wrap>
	Body content
</div>
<div data-sticky-footer>
	Footer content
</div>

Add the data-sticky-wrap attribute to a parent <div> that contains all of your page content. Add the data-sticky-footer attribute to the parent <div> that contains all of your footer content.

3. Initialize Sticky Footer.

<script>
	stickyFooter.init();
</script>

In the footer of your page, after the content, initialize Sticky Footer. And that's it, you're done. Nice work!

Installing with Package Managers

You can install Sticky Footer with your favorite package manager.

  • NPM: npm install cferdinandi/sticky-footer
  • Bower: bower install https://github.com/cferdinandi/sticky-footer.git
  • Component: component install cferdinandi/sticky-footer

Working with the Source Files

If you would prefer, you can work with the development code in the src directory using the included Gulp build system. This compiles, lints, and minifies code.

Dependencies

Make sure these are installed first.

Quick Start

  1. In bash/terminal/command line, cd into your project directory.
  2. Run npm install to install required files.
  3. When it's done installing, run one of the task runners to get going:
    • gulp manually compiles files.
    • gulp watch automatically compiles files when changes are made and applies changes using LiveReload.

Options and Settings

Sticky Footer includes smart defaults and works right out of the box. But if you want to customize things, it also has a robust API that provides multiple ways for you to adjust the default options and settings.

Global Settings

You can pass callbacks into Sticky Footer through the init() function:

stickyFooter.init({
	selectorWrap: '[data-sticky-wrap]', // Selector for the wrap container (must use a valid CSS selector)
	selectorFooter: '[data-sticky-footer]', // Selector for the footer (must use a valid CSS selector)
	callback: function () {}, // Runs after the footer is stuck
});

Use Sticky Footer events in your own scripts

You can also call Sticky Footer events in your own scripts.

destroy()

Destroy the current stickyFooter.init(). This is called automatically during the init function to remove any existing initializations.

stickyFooter.destroy();

Browser Compatibility

Sticky Footer works in all modern browsers, and IE 9 and above.

Sticky Footer is built with modern JavaScript APIs, and uses progressive enhancement. If the JavaScript file fails to load, or if your site is viewed on older and less capable browsers, footers will simply float up against the content like they normally would.

How to Contribute

In lieu of a formal style guide, take care to maintain the existing coding style. Please apply fixes to both the development and production code. Don't forget to update the version number, and when applicable, the documentation.

License

The code is available under the MIT License.