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

proper-ripple

v0.4.5

Published

A material design ripple your designer wouldn't be ashamed of.

Downloads

26

Readme

Ripple.js • Code Climate Build Status

Dependency-free Material Design ripple effect for the web, that wouldn't interfere your elements' DOM.

  • Tiny (3kb gzipped, even less with your webpack)
  • Doesn't need a DOM node as a host, you can create ripples over inputs and images without hacks
  • Customizable
  • Capable of creating multiple ripples at once
  • Enlarges on mousedown, fades out on mouseup
  • Works with touch devices
  • Has simple API
  • Supports IE 10+
  • Runs smoothly (always 30+ fps) on low-end devices (with power of CSS3 transitions)

See a Demo

Getting Ripple.js

Like a vendor lib

Check the latest release

via npm

$ npm install proper-ripple --save-dev

via yarn

$ yarn add proper-ripple

Make sure to include it in your webpack (npm/yarn usage) (uses babel-loader with es-2015 preset & css-loader)

Usage

This is how you can tell Ripple.js to watch any element matching a selector (including dynamically added)

ripple.watch('#demo-2 button')

This is how you can add a listener to an element \ array of elements (DOM nodes)

var yourElement = document.querySelector('.login-button')
var manyNodes = document.querySelectorAll('button')

ripple.bindTo(yourElement) //will trigger on your element
ripple.bindTo(manyNodes) //will trigger on any of these

This is how you can remove all listeners (rippleBind is the same for ripple.bindTo)

var rippleBind = ripple.watch('#demo-2 button')
rippleBind.remove()

Customization

Full set of props

{
  color: "#fafafa", //{string} background color (like in CSS)
  opacity: 0.21, //{number} ripple max opacity (like in CSS)
  borderRadius: 'auto', //auto -- copy target props OR {Srting} CSS prop value
  borderWidth: 'auto',  //auto -- copy target props OR {number} CSS prop value !IN PX!
  zIndex: 999, //{number}
  transitionDuration: 500, //{number} in ms
  timingFunction: "cubic-bezier(.4,0`,.42,1)", //{string} transition timing function
  constant: false //{bool} enlarging speed is constant on any element size
}

Changing props

Way A

var rippleBind = ripple.watch('#demo-2 button')
rippleBind.factory.rippleProps = {
	opacity: 0.41,
	transitionDuration: 700,
} //it's a plain js object

rippleBind.factory.rippleProps.color = '#000'

Way B

var myProps = {
	color: '#000',
	opacity: 0.4,
	transitionDuration: 700
}

ripple.watch('#demo-2 button', myProps)
ripple.bindTo(manyNodes, myProps)

Way C

ripple.setDefaults({
	color: '#000',
	opacity: 0.41,
	transitionDuration: 700
})

Running tests

There are 2 ways to run tests for Ripple.js

  1. PhantomJS
  2. Browser mocha tests

Test's specs files are the same, but for the sake of PhantomJS they must be written in ES5

CLI PhantomJS testing

Assuming you have all devDependencies installed

$ npm test

Browser testing

$ npm run test-browser