JSFiddle - React, Tailwind, and code Playground

by skram

HTML

<div id="test"></div>

CSS

.hover { background-color: #ebebeb;   }

#test { border: 1px solid #c3c3c3; width: 200px; height: 200px;}

JavaScript

$("#test").hover(
// Mouse Over


function(e) {
    console.log(e.type);
    $(this).addClass("hover");
},
// Mouse Out


function(e) {
    console.log(e.type);
    $(this).removeClass("hover");
});

var t = 1;
setInterval(function() {
    if (t) {
        $("#test").mouseenter()
    } else {
        $('#test').mouseleave();
    }
    t = t?0:1;
}, 1000);