Last active
June 3, 2017 09:30
-
-
Save sdgluck/465cfbde9aa1c2cef53b to your computer and use it in GitHub Desktop.
An extension of Angular's angular.element prototype with method doAnim; a function to invoke CSS animations.
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
/** | |
* Invoke a CSS animation on `this` angular.element instance. | |
* @param className classname of animation to invoke on `this` element | |
* @param delay delay before animation is invoked | |
* @param done callback | |
*/ | |
angular.element.prototype.doAnim = function(className, delay, done, doneDelay) { | |
done = (typeof delay === 'function') ? delay : done; | |
$timeout(function() { | |
this.removeClass(className); | |
$timeout(function() { | |
this.addClass(className); | |
$timeout(done, doneDelay || 0); | |
}.bind(this), 100); | |
}.bind(this), delay || 0); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment