Skip to content

Instantly share code, notes, and snippets.

@brycedorn
Created May 29, 2014 18:39
Show Gist options
  • Save brycedorn/8ee7fcb8ed6cad305215 to your computer and use it in GitHub Desktop.
Save brycedorn/8ee7fcb8ed6cad305215 to your computer and use it in GitHub Desktop.
proper css transitions
<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