JSFiddle - React, Tailwind, and code Playground

by mjmitche

HTML

<div id="tobemoved"></div>

<div id="blueclick"></div>

<div id="redclick"></div>

CSS

#tobemoved {background: brown; width: 20px; height:20px; top:5px; left: 50px; position: absolute;}

#blueclick {background: blue; width: 20px; height: 20px; top: 60px; left: 250px; position: absolute;}

#redclick {background: red; width: 20px; height: 20px; top: 100px; left: 250px; position: absolute;}

JavaScript

$("#blueclick").click(function(){
    $("#tobemoved").animate({ 
        top: "+=250px",
        left: "+=50px"
    }, 5000 );
});


$("#redclick").click(function(){
    $("#tobemoved").fadeOut(1000);
});