JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/css/base/jquery.ui.all.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.2/css/lightness/jquery-ui-1.10.2.custom.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.2/jquery.ui.touch-punch.min.js"></script>
<div class="container">
<div class="demo">
<div id="draggable" class="ui-widget-content">
<p>Drag me to my target</p>
</div>
<div id="droppable" class="ui-widget-header">
<p>Drop here</p>
</div>
</div>
<div class="demo-description" style="display: none; ">
<p>Enable any DOM element to be droppable, a target for draggable elements.</p>
</div>
</div>
<audio id="audio-drag"...
CSS
body {
background: #fff;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
#draggable {
width: 100px;
height: 100px;
padding: 0.5em;
float: left;
margin: 10px 10px 10px 0;
}
#droppable {
width: 150px;
height: 150px;
padding: 0.5em;
float: left;
margin: 10px;
}
JavaScript
$(function() {
$("#draggable").draggable({
start: function() {
$("#audio-drag")[0].play();
}
});
$("#droppable").droppable({
drop: function(event, ui) {
$("#audio-drop")[0].play();
$(this)
.addClass("ui-state-highlight")
.find("p")
.html("Dropped!");
}
});
});