JSFiddle - React, Tailwind, and code Playground

by Nicolas PUJOL

HTML

<div id="main">Chargement...</div>

CSS

a:hover, a:active {
    color: #333;
}
.btn {
    background: none repeat scroll 0 0 rgba(0, 0, 0, 0);
    cursor: pointer;
    display: inline-block;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 25px 80px;
    position: relative;
    text-transform: uppercase;
    transition: all 0.3s ease 0s;
}
.btn:after {
    content:'';
    position: absolute;
    z-index: -1;
    -webkit-transition: all 0.3s;
    -moz-transition: all 0.3s;
    transition: all 0.3s;
}
.btn-blue {
    border: 3px solid #0e83cd;
    color: #0e83cd;
}
.btn-blue-slide {
    overflow: hidden;
}
.btn-blue-slide:after {
    width: 100%;
    height: 0;
    top: 50%;
    left: 50%;
    background-color: #0e83cd;
    opacity: 0;
    -webkit-transform: translateX(-50%) translateY(-50%) rotate(45deg);
    -moz-transform: translateX(-50%) translateY(-50%) rotate(45deg);
    -ms-transform: translateX(-50%) translateY(-50%) rotate(45deg);
    transform: translateX(-50%) translateY(-50%) rotate(45deg);
}
.btn-blue-slide:hover, .btn-blue-slide:active {
    color: #fff;
}
.btn-blue-slide:hover:after {
    height: 260%;
    opacity: 1;
}
.btn-blue-slide:active:after {
    height: 400%;
    opacity: 1;
}
.no_selection {
    -webkit-user-select: none;
    /* webkit (safari, chrome) browsers */
    -moz-user-select: none;
    /* mozilla browsers */
    -khtml-user-select: none;
    /* webkit (konqueror) browsers */
    -ms-user-select: none;
    /* IE10+ */
}
.stat {
    display: inline-block;
    margin-right: 10px;
}

JavaScript

$(function () {
    init();
    var nbClicks = 0;
    var valClick = 1;
    var powerClick = 1;
    var total = 0;
    var helpers = [0, 0, 0];
    var helpersValue = [1, 1, 1];
    var helpersTime = [0, 0, 0];
    var t0 = null;
    var t1 = null;
    var t2 = null;

    function init() {
        preLoader();
    }

    function preLoader() {
        preloadImg([
            'img/imageName.jpg',
            'img/anotherOne.jpg',
            'img/blahblahblah.jpg']);
        loaded();
    }

    function preloadImg(arrayOfImages) {
        $(arrayOfImages).each(function () {
            $('<img/>')[0].src = this;
        });
    }

    function loaded() {
        $("#main").html("Total : <div id=\"total\" class=\"stat\">0</div>" +
            "Power : <div id=\"power\" class=\"stat\">1</div>" +
            "Val : <div id=\"val\" class=\"stat\">1</div><br>" +
            "<div id=\"btnClick\" class=\"btn btn-blue btn-blue-slide no_selection\">click me</div>" +
            "<div id=\"powerClick\" class=\"btn btn-blue btn-blue-slide no_selection\">power++</div>" +
            "<div id=\"valClick\" class=\"btn btn-blue btn-blue-slide no_selection\">val++</div>" +
            "<div id=\"helper-0\" class=\"btn btn-blue btn-blue-slide no_selection helper\">b helper0 : <span id=\"nbHelper0\">0</span></div>" +
            "<div id=\"helper-1\" class=\"btn btn-blue btn-blue-slide no_selection helper\">b helper1 : <span id=\"nbHelper1\">0</span></div>" +
            "<div id=\"helper-2\" class=\"btn btn-blue btn-blue-slide no_selection helper\">b helper2 : <span id=\"nbHelper2\">0</span></div>");
        $("#btnClick").on("click", function () {
            updateTotal();
        });
        $("#powerClick").on("click", function () {
            updatePowerClick();
        });
        $("#valClick").on("click", function () {
            updateValClick();
        });
        $(".helper").on("click", function () {
            updateHelperNb($(this)[0].id);
        });
    }

 ...