Created
October 16, 2013 13:59
-
-
Save szpakoli/7008193 to your computer and use it in GitHub Desktop.
Using animate.css with a bit of jquery to expand functionality
From http://josebrowne.com/open/tutorial-easy-css-animations-with-animate-css
http://daneden.me/animate/
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 animationClick(element, animation){ | |
element = $(element); | |
element.click( | |
function() { | |
element.addClass('animated ' + animation); | |
//wait for animation to finish before removing classes | |
window.setTimeout( function(){ | |
element.removeClass('animated ' + animation); | |
}, 2000); | |
} | |
); | |
}; |
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 animationHover(element, animation){ | |
element = $(element); | |
element.hover( | |
function() { | |
element.addClass('animated ' + animation); | |
}, | |
function(){ | |
//wait for animation to finish before removing classes | |
window.setTimeout( function(){ | |
element.removeClass('animated ' + animation); | |
}, 2000); | |
} | |
); | |
}; |
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
//allow you to have a separate trigger element. (ex: hover or click logo animates sloganText) | |
$(document).ready(function(){ | |
function animationClick(trigger, element, animation){ | |
element = $(element); | |
trigger = $(trigger); | |
trigger.click( | |
function() { | |
element.addClass('animated ' + animation); | |
//wait for animation to finish before removing classes | |
window.setTimeout( function(){ | |
element.removeClass('animated ' + animation); | |
}, 2000); | |
}); | |
} | |
function animationHover(trigger, element, animation){ | |
element = $(element); | |
trigger = $(trigger); | |
trigger.hover( | |
function() { | |
element.addClass('animated ' + animation); | |
}, | |
function(){ | |
//wait for animation to finish before removing classes | |
window.setTimeout( function(){ | |
element.removeClass('animated ' + animation); | |
}, 2000); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment