Skip to content

Instantly share code, notes, and snippets.

@pketh
Last active August 29, 2015 13:58
Show Gist options
  • Save pketh/10022880 to your computer and use it in GitHub Desktop.
Save pketh/10022880 to your computer and use it in GitHub Desktop.
Runs one animation after the first completes
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