JSFiddle - React, Tailwind, and code Playground
HTML
<div class="image1 image">
<p>Hover for cat 1</p>
</div>
<div class="image2 image">
<p>Hover for cat 2</p>
</div>
<div class="image3 image">
<p>Hover for cat 3</p>
</div>
<div class="default">
<p>Default Text</p>
</div>
<div id="cats">
<p class="cat1">Category 1 text</p>
<p class="cat2">Category 2 text</p>
<p class="cat3">Category 3 text</p>
</div>
CSS
.cat1 {
display: none;
}
.cat2 {
display: none;
}
.cat3 {
display: none;
}
* {
font-size: 20px;
text-align: center;
}
.image1, .image2, .image3 {
float: left;
width: 150px;
border: thin solid #CCC;
margin-bottom: 20px;
}
#cats, .default {
width: 450px;
}
JavaScript
$(".image").hover(function() {
$(".default").toggle();
$("#cats p").eq($(this).index()).toggle();
});