Created
December 21, 2013 02:02
-
-
Save jahanson/8064548 to your computer and use it in GitHub Desktop.
Ready to go sample to add class on animation on click and remove when the animation ends via jQuery.
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Animate.css test</title> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/animate.css/3.0.0/animate.min.css"> | |
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
var myButton = $('#button'); | |
myButton.click(function () { | |
myButton.addClass('bounce'); | |
myButton.one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', | |
function(e) { | |
// code to execute after animation ends | |
myButton.removeClass('bounce'); | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<button id="button" class="animated">Hey!</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment