JSFiddle - React, Tailwind, and code Playground

HTML

<div class="parent" style="background-color:black;width:100px;height:500px;overflow:scroll;">
    <div class="child" style="background-color:blue;width:100px;height:1000px"></div>
</div>

JavaScript

var lastMove;
$(window).mousemove(function (e) {
    lastMove = new Date();
     $(".child").css("background-color", "red");
    
    lastTimeMouseMoved = new Date().getTime();
       var t=setTimeout(function(){
           var currentTime = new Date().getTime();
           if(currentTime - lastTimeMouseMoved > 10){
               $(".child").css("background-color", "blue");
           }
       },10);
 });