JSFiddle - React, Tailwind, and code Playground
by Oliver_kh
HTML
<div id="menu">
<a href="" class="hov" id="link1">11111</a>
<a href="" class="hov" id="link2">22222</a>
<a href="" class="hov" id="link3">333333</a>
</div>
JavaScript
$(document).ready(function () {
var first = 0;
var last_id = 0;
var id_now = 0;
$(".hov").hover(
function () {
id_now = this.id;
if (first != 0) {
$("#link" + last_id).fadeOut(500, function () {
$("#link" + id_now).fadeIn(500);
});
} else {
first = 1;
$("#link" + this.id).fadeIn(500);
}
last_id = id_now;
}, function () {
$("#link" + this.id).fadeOut(500);
});
})