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

vanilla-fade

v1.1.0

Published

VanillaJS implementation of the JQuery fade methods.

Downloads

289

Readme

Vanilla JS - fade   ko-fi

npm version David David Build Status Greenkeeper badge semantic-release Commitizen friendly Contributor Covenant

Simple Vanilla JS implementation of the fadeIn(), fadeOut(), fadeTo() and fadeToggle() methods. This little package once loaded will add the mentioned methods to the Element prototype. All of the above methods accept the same paramaters: [duration, easing, complete]. Furthermore the prefers-reduce-motion is natively supported. You can read more about it here.


Find this usefull? ☕ Buy me a coffee!


Installation

This package can be downloaded from the NPM registry npm install vanilla-fade --save. Or included in via a standard script tag from this url. Once imported it will automatically initialize.

// IIFE
<script src="https://unpkg.com/vanilla-fade/dist/vanilla-fade.js">

// CJS
require('vanilla-fade/cjs'); // all the library
require('vanilla-fade/cjs/fadeIn'); // single animation
require('vanilla-fade/cjs/fadeOut'); // single animation
require('vanilla-fade/cjs/fadeToggle'); // single animation
require('vanilla-fade/cjs/fadeTo'); // single animation

// ESM
import 'vanilla-fade/esm'; // all the library
import 'vanilla-fade/esm/fadeIn'; // single animation
import 'vanilla-fade/esm/fadeOut'; // single animation
import 'vanilla-fade/esm/fadeToggle'; // single animation
import 'vanilla-fade/esm/fadeTo'; // single animation

Usage

After import the package the Element.prototype.fadeIn(), Element.prototype.fadeOut(), Element.prototype.fadeTo() and Element.prototype.fadeToggle() will be available to use. The methods accepts the following paramenters:

Element.fadeIn(duration = 250, easing = 'linear', complete = null)
Element.fadeOut(duration = 250, easing = 'linear', complete = null)
Element.fadeTo(duration = 250, opacity = NaN, easing = 'linear', complete = null)
Element.fadeToggle(duration = 250, easing = 'linear', complete = null)
  • duration can be a number or a string representing and integer of milliseconds.
  • opacity final opacity value. Required only in fadeTo
  • easing should be one of the following string: [linear, quadratic, swing, circ, bounce].
  • complete is a callback that will be executed after the animation completes.

The Element display property won't change after fading out. No assumption on the original display value or opacity value are made. Once triggered the opacity will go from 0 -> 1 and viceversa. So if the element original opacity was .5 this value won't be considered when toggling the fading effect.

Browser support

Babel will automatically transpile according to the following browserslist:

# Browsers that we support

defaults