JSFiddle - React, Tailwind, and code Playground

http://stackoverflow.com/questions/7302824/animating-addclass-removeclass-with-jquery

by willianjohns

HTML

<div id="test" class="blue"></div>

CSS

#test{
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;
}
.blue{
    background-color: blue;
    width: 100px;
    height: 100px;
}
.red{
    background-color: red;
    width: 100px;
    height: 100px;
}

JavaScript

$('#test').hover(function() {
    $(this).addClass('red');
}, function() {
    $(this).removeClass('red');
});