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

wheelz

v1.0.4

Published

Fun, acceleration based scroller.

Downloads

56

Readme

Wheelz

Fun, acceleration based scroller. Animates and smoothens the scroll of element content. Uses native scroll, so any scroll events on the element will work as expected by default.
Demo here

Installation

Include Wheelz with scripts tag

<script src="./dist/wheelz.min.js"></script>

or with npm and import

npm install wheelz --save
// import needed modules from npm
import Wheelz from 'wheelz';

Options

Wheelz accepts several options defined as follows.

var options = { option: "value" }
var wheelz = new Wheelz(options);

friction

Recommended value 0-1. Default value is 0.3.

acceleration

Recommended value 0-1. Default value is 0.04.

preset

Sets the friction and acceleration to the proposed values.
Available values:
normal = f0.5, a0.2
smooth = f0.3, a0.04
instant = f0.55, a0.4
bounce = f0.3, a0.08
slow = f0.3, a0.02

var wheelz = new Wheelz({
    preset: "smooth"
});

draggable

Makes the are of scrolled element draggable with mouse. Can be set to true or false.

var wheelz = new Wheelz({
    draggable: false
});

Events

Wheelz emits a bunch of events while it works. You can subscribe to events with on and off methods.

// init
var wheelz = new Wheelz();

// set handler
wheelz.on('scroll', function () {
    // do something on every animation tick
});

wheelz.off('scroll', handler); // removes single handler
wheelz.off('scroll'); // removes all handlers for 'tick' event
wheelz.off(); // removes all handlers

List of all events

  • click - triggered on click of the root element
  • disable - triggered before disabling Wheelz (with disable method)
  • drag - triggered when on every tick of dragging
  • dragEnd - triggered when drag on root element ends
  • dragStart - triggered when drag on root element starts
  • hitBottom - triggered when scroll hits bottom
  • hitTop - triggered when scroll hits top
  • pointerDown - triggered when mouse is pressed over a root element
  • pointerEnter - triggered when mouse cursor enters a root element
  • pointerUp - triggered when press ends
  • pointerLeave - triggered when mouse cursor leaves root element
  • resize - triggered on window resize
  • stabilized - triggered when scroll ends (values of actual scrollTop and animated scroll are at the same value)
  • scroll - triggered on every tick of scroll animation
  • scrollStart - triggered when scroll starts
  • scrollEnd - triggered when scroll ends (same as stabilized... only for clarity)
  • wheel - triggered on mouse wheel over the root element

Plugins

Plugins use wheelz events to modify the visual appearance of scroll. Plugins can also be imported from npm or loaded with script tag.

<script src="./dist/plugins/pluginName.min.js"></script>

or with npm and import

// import needed modules from npm
import pluginsName from 'wheelz/plugins/pluginsName';

addScrollbar

Scrollbar adds scrollbar visualising both, the actual scrollTop value and the scrollTop animated value of wheelz. Scrollbar styles are inserted at the top of head tag, so styles can be rewritten with any styles included afterwards.

Usage:

var wheelz = new Wheelz();
addScrollbar(wheelz);

delayItems

Creates effect of delayed items, similar to one seen in Apple iOS iMessage application.

Usage:

var wheelz = new Wheelz();
delayItems(wheelz);