JSFiddle - React, Tailwind, and code Playground

HTML

<div class="moving">Item 1</div>
<div class="moving">Item 2</div>
<div class="moving">Item 3</div>
<div id="move-back">Click to Move To Orignal Pos</div>

CSS

.moving{
    width: 100px;
    float:left;
}


#move-back{
    position: absolute;
    top: 200px;
    border: 1px solid lightgray;
}

JavaScript

var originalPos =[];

//Store Original
$(".moving").each(function(){
    originalPos.push({"left":$(this).offset().left,"top":$(this).position().top});
});

//rearrange
$(".moving").each(function(i,e){
    $(this).css("position", "absolute");
    $(this).css("left",100 * ((3-i)-1));                
});


//move back to original - if needed you could also set top
$("#move-back").click(function(){
    $(".moving").each(function(i,e){
        var position = originalPos[i];
        $(this).css("left",originalPos[i].left);                
    });
});