A pure javascript (no polymer, no jQuery) AngularJS directive that adds a Google Material Design ripple effect when clicked or touched.
Angular Material is cool, but sometimes you just want the ripple effect in your angular app without all the bloat. That’s why we made this.
Ain't nobody f*ckin' with my Clique
Here's a demo
bower install --save angular-ripple
Include the script in your HTML
<script type="text/javascript" src="bower_components/angular-ripple/angular-ripple.js"></script>
Then include angularRipple
in your module dependencies
angular.module('yourApp', ['angularRipple']);
Then add the angular-ripple
attribute to elements
<button angular-ripple>Ripple!</button>
Add some styles to the ripple (remember to include browser specific prefixes)
[angular-ripple] {
position: relative;
overflow: hidden;
}
.angular-ripple {
display: block;
position: absolute;
background-color: rgba(0,0,0,0.1);
border-radius: 50%;
transform: scale(0);
}
.angular-ripple.animate {
animation: ripple 0.35s linear;
}
@keyframes ripple {
100% {
opacity: 0;
transform: scale(2.5);
}
}
The MIT License
Copyright (c) 2014 Nelson Cash http://www.nelsoncash.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Mike McMillan (@MikeMcChillin)
- Matthew Frey (mmmeff)
- storuky
- Fixed GH Issue #13, which changes mouseup to mousedown and touchend to touchstart.
- Merged in @storuky's commit to fix double event call on iOS.
- Merged in @mmmeff's commit to fix degredation and event handling
- Added scope.$on('$destroy')
- Changed ripple position calculation to work with scrolling divs, using this method. Closes out GH issue #1.
- Changed ripple position calculation from getClientBoundingRect() to getPos() to be much more accurate.
- This changelog
- Ripple position calculation, based on antoinepairet's fork
- Added moz & webkit prefixes to demo page's CSS.
Big props to this demo
Built by Nelson Cash.
We're hiring in Chicago. Hit us up.