JSFiddle - React, Tailwind, and code Playground

by aldomatic

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
<div id="wrap">
<div class="draggable"></div>
<div class="draggable"></div>
<div class="draggable"></div>
</div>

CSS

.draggable {
    background-color:#ace;
    width:50px; height:50px;
    position:absolute;
}

#wrap{
     width:200px;
     height:200px;
   border:solid #ccc 1px; 
}

JavaScript

$('.draggable').each(function(i,el){
    var tLeft = Math.floor(Math.random()*200),
        tTop  = Math.floor(Math.random()*200),
        bgcol = '#' + Math.floor(Math.random()*99)
                    + Math.floor(Math.random()*99)
                    + Math.floor(Math.random()*99);
    $(el).css({left: tLeft, top: tTop, 'background-color': bgcol});
});