Last active
August 29, 2015 13:58
-
-
Save pketh/10022880 to your computer and use it in GitHub Desktop.
Runs one animation after the first completes
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
function sequentialAnimation(first, second, triggerClass) { | |
first.one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function() { | |
second.addClass(triggerClass); | |
}); | |
} | |
// sample usage | |
sequentialAnimation($('.first-element-with-animation'), $('.element-to-animate-after'), 'classname-which-triggers-animation-on-the-second-element'); | |
// the classname animation trigger is usally a rule with the animation duration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment