JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css">
<div id='button' class='normal'>my button</div>

CSS

div {
    width: 100px;
    height: 75px;
    color: white;
}
.normal {
    background: blue;
}
.hover {
    background: purple;
}
.pressed {
    background: orange;
}

JavaScript

var mouseIsDown = false;
$('div').hover(function() {
    $(this).addClass('hover')
    if (mouseIsDown) $(this).addClass('pressed');
}, function() {
    $(this).removeClass('hover pressed');
}).mousedown(function() {
    mouseIsDown = true;
    $(this).addClass('pressed');
}).mouseup(function() {
    mouseIsDown = false;
    $(this).removeClass('pressed');
});

$(document).mouseup(function() {
    mouseIsDown = false;
});