JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<div id="one"></div>
<div id="two"></div>
<a href="#">The Link</a>
</div>
CSS
#container {
margin: 100px;
position: relative;
}
#container a {
color: white;
}
#container div {
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: -1;
}
#one {
background-color: blue;
}
#two {
background-color: green;
display:none;
}
JavaScript
$("#container a").hover(function () {
$("#container div:visible").fadeOut();
$("#container div:hidden").fadeIn();
});