Skip to content

Instantly share code, notes, and snippets.

@eljamez
Created December 10, 2015 21:17
Show Gist options
  • Save eljamez/d9e1e77323886ecc0aa8 to your computer and use it in GitHub Desktop.
Save eljamez/d9e1e77323886ecc0aa8 to your computer and use it in GitHub Desktop.
animate.css "animateElement" method for an ES2015 Class
// A method withn an es2015 Class
// requires animate.css (https://daneden.github.io/animate.css/)
// animation defaults to "pulse"
// call it, watch animation, end event binds and unbinds after one use, removing animate classes.
animateElement($element, animationType) {
// animate.css animate type
animationType = animationType || "pulse";
let animationClasses = 'animated ' + animationType;
let animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
$element.addClass(animationClasses).one(animationEnd,function() {
$element.removeClass(animationClasses);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment