Skip to content

Instantly share code, notes, and snippets.

@z3bbster
Forked from sdgluck/angular.element.doAnim.js
Last active August 29, 2015 14:17
Show Gist options
  • Save z3bbster/4316e952bbedac747b1a to your computer and use it in GitHub Desktop.
Save z3bbster/4316e952bbedac747b1a to your computer and use it in GitHub Desktop.
/**
* 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