Skip to content

Instantly share code, notes, and snippets.

@horacioh
Created February 10, 2014 14:33
Show Gist options
  • Save horacioh/8916967 to your computer and use it in GitHub Desktop.
Save horacioh/8916967 to your computer and use it in GitHub Desktop.
add class to animate and remove class onAnimationEnd. Took it from http://daneden.github.io/animate.css/
/*dependency on animate.css
#animationSandbox = element to be animated
.js--triggerAnimation = button to animate element
.js--animations = input select with animations
*/
function testAnim(x) {
$('#animationSandbox').removeClass().addClass(x + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
$(this).removeClass();
});
};
$(document).ready(function(){
$('.js--triggerAnimation').click(function(){
var anim = $('.js--animations').val();
testAnim(anim);
});
$('.js--animations').change(function(){
var anim = $(this).val();
testAnim(anim);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment