Skip to content

Instantly share code, notes, and snippets.

@adamcjoiner
Created February 20, 2018 15:53
Show Gist options
  • Save adamcjoiner/93015cd5aae0943100222b4ca8b9f0cc to your computer and use it in GitHub Desktop.
Save adamcjoiner/93015cd5aae0943100222b4ca8b9f0cc to your computer and use it in GitHub Desktop.
Add CSS animation to element and then reset it (to animate it again)
$('#btn-animate').click(function() {
// Shake the 'Codes' dropdown
animEl = $('#dropdown-codes');
animEl.addClass('shake animated'); // ~add the anim. CSS class
animEl.one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function (e) {
animEl.removeClass('shake animated'); // ~remove it when finished
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment