https://github.com/methodgrab/animation-events
Find the (prefixed) JavaScript event names for CSS animations & transitions supported by the current browser
https://github.com/methodgrab/animation-events
css-animations
Last synced: 3 months ago
JSON representation
Find the (prefixed) JavaScript event names for CSS animations & transitions supported by the current browser
- Host: GitHub
- URL: https://github.com/methodgrab/animation-events
- Owner: MethodGrab
- Created: 2016-06-27T13:10:39.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T01:27:32.000Z (about 3 years ago)
- Last Synced: 2025-08-28T15:22:01.974Z (5 months ago)
- Topics: css-animations
- Language: JavaScript
- Size: 1.79 MB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CSS Animation Event Names [](https://travis-ci.org/MethodGrab/animation-events) [](https://www.npmjs.com/package/@methodgrab/animation-events)
> Find the (prefixed) JavaScript event names for CSS animations & transitions supported by the current browser.
## Install
```bash
npm install --save @methodgrab/animation-events
```
## Example:
```js
const animEvents = require( '@methodgrab/animation-events' );
// get & cache the prefixed event names
const transitionEnd = animEvents.transitionEndEventName();
const animationEnd = animEvents.animationEndEventName();
const animationIteration = animEvents.animationIterationEventName();
$( '.el' )
.addClass( 'is-transitioning' )
.one( transitionEnd, ( ) => {
console.log( 'Transition complete!' );
$( '.el' ).removeClass( 'is-transitioning' );
};
```
## API
### `transitionEndEventName()`
→ `string`
Find the (prefixed) [`transitionend`](https://developer.mozilla.org/en-US/docs/Web/Events/transitionend) event name.
The `transitionend` event is fired when a CSS transition has completed.
### `animationEndEventName()`
→ `string`
Find the (prefixed) [`animationend`](https://developer.mozilla.org/en-US/docs/Web/Events/animationend) event name.
The `animationend` event is fired when a CSS animation has completed.
### `animationIterationEventName()`
→ `string`
Find the (prefixed) [`animationiteration`](https://developer.mozilla.org/en-US/docs/Web/Events/animationiteration) event name.
The `animationiteration` event is fired when **an iteration** of an animation ends.