JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<div id="object">
<p>I want to be dragged</p>
</div>
</div>
CSS
#container {
background-color: pink;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#object {
position: absolute;
background-color: gray;
width: 300px;
height: 200px;
text-align: center;
}
JavaScript
var $object = $('#object');
var $container = $('#container');
$object.css({left: ($(document).width() / 2) - ($object.width() / 2)})
.css({top: ($(document).height() / 2) - ($object.height() / 2)})
$container.draggable().bind("dragstop", function(event, ui) {
$container.css({left: 0, top: 0});
});