JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=600,user-scalable=yes" />
<title>Drag and Drop jQuery Plugin Reorder Example</title>
</head>
<body>
<div class="header">
<h1>Reorder Example</h1>
</div>
<div class="content">
<p>Drag the items below to change their order</p>
<ul id="list">
<li>Item A</li>
<li>Item B</li>
<li>Item C</li>
<li>Item D</li>
<li>Item E</li>
</ul>
<p id="msg"></p>
</div>
<div id="result"></div>
</body>
</html>
CSS
body {
margin: 0px;
font-family: Calibri, "Lucida Grande", sans-serif;
background-color: #eee;
}
div.header {
background-color: #aaf;
background-image: -moz-linear-gradient(top, #88d 0%, #88d 50%, #99d 50%, #99d 100%);
background-image: -o-linear-gradient(top, #88d 0%, #88d 50%, #99d 50%, #99d 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #88d), color-stop(0.5, #88d), color-stop(0.5, #99d), color-stop(1, #99d));
background-size: 4px 4px;
border-bottom: 2px solid #339;
}
h1 {
margin: 0px auto;
max-width: 570px;
padding: 10px 10px 10px 20px;
text-shadow: 1px 1px 0px #bbe;
font-size: 18pt;
}
div.content {
max-width: 560px;
padding: 20px;
margin: auto;
background-image: -moz-linear-gradient(-90deg, #fff 0%, #eee 100%);
background-image: -o-linear-gradient(-90deg, #fff 0%, #eee 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(1, #eee));
}
h2 {
margin: 0px 0px 15px 0px;
font-size: 16pt;
}
li {
font-size: 14pt;
}
p {
margin: 0px 0px 20px 0px;
font-size: 14pt;
}
.source {
width: 360px;
height: 60px;
margin: auto;
}
.boxes div {
float: left;
width: 60px;
height: 50px;
background-color: #bbe;
background-image: -moz-linear-gradient(-45deg, #eef, #88d);
background-image: -o-linear-gradient(-45deg, #eef, #88d);
background-image: -webkit-gradient(linear, left top, right bottom, color-stop(0, #eef), color-stop(1, #88d));
font-size: 24pt;
font-weight: bold;
text-align: center;
padding-top: 10px;
-moz-user-select: none;
-webkit-user-select: none;
}
.source div {
cursor: pointer;
}
div.whileDragging {
background-image: none;
background-color: black;
color: white;
}
div.not {
background-image: none;
background-color: #eef;
cursor: inherit;
}
div.pendingDrop {
opacity: 0.5;
}
.drop {
width:...
JavaScript
$(function() {
$(result).html($().jquery);
$(result).append($("<br/>"));
return $("li").each(function() {
return $(result).html($(result).html() + ("" + ($(this).text()) + " [TOP: " + ($(this).offset().top) + " - LEFT: " + ($(this).offset().top) + "]<br/>"));
});
});