💄 Everything can stick. Just because.
JavaScript HTML
Latest commit 185064a Feb 11, 2016 @iamvdo 2.2.1
Permalink
Failed to load latest commit information.
dist Revert: Add class is-sticky Feb 11, 2016
src Revert: Add class is-sticky Feb 11, 2016
test Fix #1: Add Pointer Events (with pointer option) Feb 10, 2016
.gitignore 💥 Init Jan 21, 2016
.npmignore Ignore demo from npm package Feb 5, 2016
README.md Update README Feb 10, 2016
build.js Simplify build Feb 5, 2016
package.json 2.2.1 Feb 11, 2016

README.md

Sticky Elements

Everything can stick. Just because.

Demo

Getting started

npm install stickyelements and insert dist/stickyelements-animate.js (or build your own bundle using src files)

Then, stick elements!

stickyElements('.item', {
  stickiness: 5,
  duration: 450
});

Arguments

CSS selector

  • Elements that will stick to your mouse

Options

  • stickiness [Integer, Object]: How long elements remain stick to your mouse. If integer, apply same x and y values. If object, can contain x and/or y key. Integer between 0 and 10. (Default: 3)
  • duration [Integer]: Duration in milliseconds of animation (using animateplus. (Default: 450)
  • pointer [Boolean]: Enable Pointer Events instead of Mouse Events. Elements will stick to mouse, touch and all input types (Default: false). Need PEP polyfill and touch-action attribute on each elements (follow PEP polyfill instructions).