JSFiddle - React, Tailwind, and code Playground
HTML
<div class="test"></div>
CSS
.test {
width: 200px;
height: 200px;
border: 2px solid #000;
}
JavaScript
jQuery.fn.mouseIsOver = function () {
return $(this).parent().find($(this).selector + ":hover").length > 0;
};
$(document).ready(function() {
console.log($('.test'));
setInterval(function(){
var $test = $(".test");
if($test.mouseIsOver()) {
$test.css('background', 'yellow');
} else {
$test.css('background', 'red');
}
}, 200);
});