JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.23/themes/base/jquery-ui.css">
<link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css">
<script src="http://code.jquery.com/ui/1.8.23/jquery-ui.min.js"></script>
<script src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/minified/i18n/jquery-ui-i18n.min.js"></script>
<div class="demo">
<div id="draggable" class="ui-widget-content">
<p>Drag me to my target</p>
</div>
<div id="dr1" class="droppable" class="ui-widget-header droppable">
<p>Drop here</p>
</div>
<div id="dr2" class="droppable" class="ui-widget-header droppable">
<p>Drop here</p>
</div>
</div>
CSS
#draggable {
width: 100px;
height: 100px;
padding: 0.5em;
float: left;
margin: 10px 10px 10px 0;
z-index: 50;
}
.droppable {
background-color: red;
width: 150px;
height: 150px;
padding: 0.5em;
float: left;
margin: 10px;
border: 1px solid black;
z-index: 45;
}
.droppable2 {
width: 150px;
height: 150px;
padding: 0.5em;
float: left;
margin: 10px;
position: absolute;
top: 25px;
left: 140px;
border: 1px solid black
}
.ui-state-disabled {
opacity: 1
}
JavaScript
$(function() {
window.a = 10;
$(".droppable,.droppable2").draggable();
$("#draggable").draggable({
tolerance: 'pointer'
});
$(".droppable").droppable({
accept: "#draggable",
drop: function(event, ui) {
var temp = ui.draggable.zIndex();
ui.draggable.css('z-index', -1000);
var topDroppable = document.elementFromPoint(event.clientX, event.clientY);
ui.draggable.css('z-index', temp);
$(topDroppable)
.addClass("ui-state-highlight")
.find("p")
.html("Dropped!");
}
});
});