Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

css-emitter

0.0.1 • Public • Published

css-emitter

fire events on css transition and animation completion

Installation

$ component install ecarter/css-emitter

Example

Styles:

#box {
  transition: all 1s ease;
  -webkit-transition: all 1s ease;
  -moz-transition: all 1s ease;
  -o-transition: all 1s ease;
  width: 100px;
  height: 100px;
  background: black;
  display: block;
}
#box.in {
  width: 200px;
  height: 200px;
}

Script:

var cssEvent = require('css-emitter');
var element = document.querySelector('#box');

css = cssEvent(element);

css.on('end', function(e){
  console.log(e);
});

setTimeout(function(){
  element.className = 'in';
}, 1000);

License

MIT

Keywords

none

Install

npm i css-emitter

DownloadsWeekly Downloads

0

Version

0.0.1

License

none

Last publish

Collaborators

  • avatar