Skip to content

jQuery plugin to provide shorthands for transition and animation events

License

Notifications You must be signed in to change notification settings

herrmannplatz/jquery.motionevents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Motion Events Plugin

Shorthands for transtion and animation events.

Usage

You can subscribe to 'transtionend', 'animationstart', 'animationiteration' and 'animationend' events by calling a function with the same name on your jquery element.

NOTE: Return true will dispose the event subscription.

$('div').transitionend(function(e) {
  // do some stuff
  return true;
});

$('div').animationend(function(e) {
  // do some stuff
  return true;
});

To listen to a specific transition, e.g. when using multiple properties, provide an object with the properties as keys.

$('div').transitionend({
  opacity: function(e) {
    // do some stuff
    return true;
  },
  color: function(e) {
    // do some stuff
    return true;
  }
});

Same applies for animations. Just specify the animation name in the object passed to the function. This might be useful when you use different animations to create one big animation.

$('div').animationend({
  fadein: function(e) {
    // do some stuff
    return true;
  },
  fadeout: function(e) {
    // do some stuff
    return true;
  }
});

About

jQuery plugin to provide shorthands for transition and animation events

Resources

License

Stars

Watchers

Forks

Packages