JSFiddle - React, Tailwind, and code Playground

by ric47121

HTML

<div class="block bgcolor-rgb">Click me</div>

CSS

body {
                background: #232323 url(http://static.pioupioum.fr/img/patterns/002.gif) repeat 0 0;
            }
            div {
                position:absolute;
                cursor:pointer;
                line-height:70px;
                text-align:center;
            }
            .block {
                color:#FFF;
                height:70px;
                margin:20px 10px;
                width:150px;
            }
            .bgcolor-rgb {
                background-color: #68BFEF;
            }

JavaScript

$(".block").click(function() {
    $(this).animate({
        "backgroundColor": "rgba(203, 54, 191, .4)",
        "left": "+=80px"
    }, 1500)
    .animate({ "backgroundColor": "rgba(46, 116, 205, .4)" }, 230)
    .animate({ "backgroundColor": "rgba(44, 204, 64, .4)" },  230)
    .animate({ "backgroundColor": "rgba(207, 141, 51, .4)" }, 230)
    .animate({ "backgroundColor": "rgba(203, 54, 191, .4)" }, 230)
    .delay(250)
    .animate({
        "backgroundColor": "#68BFEF",
        "left": "+=50px"
    }, 1500)
    .delay(600)
    .animate({
        "backgroundColor": "#68BFEF",
        "left": "10px"
    }, 1500)
});