JSFiddle - React, Tailwind, and code Playground
by canassa
HTML
<button>Add toy</button>
<div id="wall">
</div>
CSS
#wall {
position: relative;
overflow: hidden;
width: 300px;
height: 300px;
background-color: grey;
margin: 50px
}
.toy {
width: 100px;
height: 25px;
background-color: orange;
position: absolute;
z-index: 0;
cursor: move;
}
JavaScript
$("button").click(function () {
$("#wall").append(
$('<div class="toy">Toy</div>')
.css('background-color', 'rgb('
+ (Math.floor(Math.random() * 256)) + ','
+ (Math.floor(Math.random() * 256)) + ','
+ (Math.floor(Math.random() * 256)) + ')')
.draggable());
})