Created
May 29, 2014 18:39
-
-
Save brycedorn/8ee7fcb8ed6cad305215 to your computer and use it in GitHub Desktop.
proper css transitions
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
<style> | |
.tran { | |
-webkit-transition: all .4s ease-in-out; | |
-moz-transition: all .4s ease-in-out; | |
-ms-transition: all .4s ease-in-out; | |
-o-transition: all .4s ease-in-out; | |
transition: all .4s ease-in-out; | |
} | |
#good:hover { | |
color: green; | |
} | |
#bad:hover { | |
color: red; | |
} | |
</style> | |
<script> | |
$("#bad").hover(function() { | |
$(this).addClass('tran'); | |
$(this).delay(400).animate({width:'100%'}, 'slow', function(){ | |
$(this).removeClass('tran'); | |
}); | |
}); | |
</script> | |
<h2 #good>Good</h2> | |
<h2 #bad>Bad</h2> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment