JSFiddle - React, Tailwind, and code Playground

by slashingweapon

HTML

<div id="wrapper">
    <div id="o1" class="square"></div>
    <div id="o2" class="square"></div>
</div>

CSS

#wrapper {
    width: 100px;
    height: 100px;
    position: relative;
}
.square {
    width: 100px;
    height: 100px;
    position: absolute;
}
#o1 {
    background: red;
}
#o2 {
    background: blue;
    display:none; 
}

JavaScript

$(function(){
    var o1 = $("#o1");
    var o2 = $("#o2");
    $('#wrapper').hover(function() {
        o1.fadeOut(400,function () {
            o2.fadeIn(400);
        });
    }, function() {
        o2.fadeOut(400,function () {
            o1.fadeIn(400);
        });
    });
});