Created
December 10, 2015 21:17
-
-
Save eljamez/d9e1e77323886ecc0aa8 to your computer and use it in GitHub Desktop.
animate.css "animateElement" method for an ES2015 Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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