JSFiddle - React, Tailwind, and code Playground

HTML

<div style="background:#98bf21;height:100px;width:100px;position:absolute;"></div>

JavaScript

var interval = null;
interval = window.setInterval(function(){animatedCode()},1000);

function animatedCode() {
    $("div").animate({left: '+=500px'});
}

//Stop and start on hover
$('div').hover(function() {
    window.clearInterval(interval);    
}, function() {
    interval = window.setInterval(function(){animatedCode()},1000);
});