JSFiddle - React, Tailwind, and code Playground
HTML
<div class="outer">
<div class="inner">
<div class="inner2">
</div>
</div>
</div>
<div class="mousemovement"></div>
CSS
.outer {
background-color: #aeaeae;
height: 200px;
width: 200px;
float: left;
}
.inner {
margin: 5px 0px;
background-color: #ccc;
height: 100px;
width: 100px;
float: left;
}
.inner2 {
margin: 5px 0px;
background-color: #9c9;
height: 60px;
width: 60px;
float: left;
}
.activeHover {
background-color: green;
}
JavaScript
var count = 0;
var counts = 0;
$('div').on({
mousemove: function(event) {
var hover = $(this).is(":hover");
if (hover) {
if (count > 200) {
$('.mousemovement').html('');
counts++;
count=0;
$('.mousemovement').append(counts);
}
}
count++;
}
});