JSFiddle - React, Tailwind, and code Playground

by albertmatyi

HTML

<a class="btn">Hover me for a while</a>

<div class="result"></div>

CSS

.btn {
    display: inline-block;
    padding: 1em;
    background-color: #39f;
    color: #fff;
    text-transform: uppercase;
    font-weight: 100;
    cursor: pointer;
    font-family: sans;
}

.result {
    
    display: block;
    background-color: #93f;
    height: 200px;
    width: 200px;
    margin-top: -100px;
    margin-left: -100px;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    top: 50%;
    transition: all 1s ease;
    -webkit-transition: all .5s ease;
}
.result.success {
    background-color: #9f3;
}

JavaScript

$(".btn").on('mouseenter', function(e){
    var timeout = setTimeout(function(){
        $('.result').toggleClass('success');
    }, 1000);
    $(e.currentTarget).on('mouseleave', function () {
        clearTimeout(timeout);
    });
});