proper-on-transition-end
Cross-browser transitionend
event listener.
This module is based on on-transition-end, which no longer seems to be maintained and is not working properly.
import onTransitionEnd from 'proper-on-transition-end';
const onTransitionEnd = window.onTransitionEnd;
const element = document.getElementById('transitioning-element');
onTransitionEnd(element, 1000, () => console.log('done'));
Installation
$ npm install proper-on-transition-end
Usage
onTransitionEnd(element, duration, callback)
element
: The element that is transitioning.duration
: The expected duration of the transition, in milliseconds. Note that there is an implicit grace period of 100
milliseconds before the event times out. If you'd like to tweak this, instead of providing a Number
, you can provide an object as follows { duration: 1000, gracePeriod: 200 }
.callback
: The callback that is called when the transition ends.
Tests
$ npm test
$ npm test-cov
to get coverage report
License
Released under the MIT License.