JSFiddle - React, Tailwind, and code Playground

HTML

<div id="background">
    <div id="active"></div>
    <div id="inactive"></div>
</div>

CSS

#active {
    position:absolute;
    top: 20px;
    left: 20px;
    width: 60px;
    height: 30px;
    background-color: blue;
    cursor: pointer;
    z-index: 1;
    }
    
#inactive{
    position:absolute;
    top: 20px;
    left: 20px;
    width: 60px;
    height: 30px;
    background-color: red;
    cursor: pointer; 
    }

#background{
    position: relative;
    margin: 0 auto;
    width:300px;
    height: 300px;
    border: 1px solid;
    border-color:#CCC;
    text-align: center;
    cursor: pointer; 
}

JavaScript

$(function(){      
    $("#inactive").mouseenter(function() {
        $("#active").fadeIn();
    });
    
    $("#active").mouseleave(function() {
        $("#active").fadeOut();
    });
    $("#active").hide();
})