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
  • Select an option

  • Save z3bbster/4316e952bbedac747b1a to your computer and use it in GitHub Desktop.

Select an option

Save z3bbster/4316e952bbedac747b1a to your computer and use it in GitHub Desktop.

Revisions

  1. @sdgluck sdgluck renamed this gist Jan 12, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @sdgluck sdgluck renamed this gist Jan 12, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @sdgluck sdgluck renamed this gist Jan 12, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. @sdgluck sdgluck revised this gist Jan 12, 2015. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,5 @@
    /**
    * Invoke a CSS animation on `this` angular.element instance. Wait for the animation to complete and then
    * remove the class from the element so it can be repeated in the future by calling this function again.
    * 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
  5. @sdgluck sdgluck revised this gist Jan 12, 2015. No changes.
  6. @sdgluck sdgluck created this gist Jan 12, 2015.
    17 changes: 17 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    /**
    * Invoke a CSS animation on `this` angular.element instance. Wait for the animation to complete and then
    * remove the class from the element so it can be repeated in the future by calling this function again.
    * @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);
    };