项目作者: MethodGrab

项目描述 :
Find the (prefixed) JavaScript event names for CSS animations & transitions supported by the current browser
高级语言: JavaScript
项目地址: git://github.com/MethodGrab/animation-events.git
创建时间: 2016-06-27T13:10:39Z
项目社区:https://github.com/MethodGrab/animation-events

开源协议:

下载


CSS Animation Event Names Build Status @methodgrab/animation-events"">npm

Find the (prefixed) JavaScript event names for CSS animations & transitions supported by the current browser.

Install

  1. npm install --save @methodgrab/animation-events

Example:

  1. const animEvents = require( '@methodgrab/animation-events' );
  2. // get & cache the prefixed event names
  3. const transitionEnd = animEvents.transitionEndEventName();
  4. const animationEnd = animEvents.animationEndEventName();
  5. const animationIteration = animEvents.animationIterationEventName();
  6. $( '.el' )
  7. .addClass( 'is-transitioning' )
  8. .one( transitionEnd, ( ) => {
  9. console.log( 'Transition complete!' );
  10. $( '.el' ).removeClass( 'is-transitioning' );
  11. };

API

transitionEndEventName()

string
Find the (prefixed) transitionend event name.
The transitionend event is fired when a CSS transition has completed.

animationEndEventName()

string
Find the (prefixed) animationend event name.
The animationend event is fired when a CSS animation has completed.

animationIterationEventName()

string
Find the (prefixed) animationiteration event name.
The animationiteration event is fired when an iteration of an animation ends.