JSFiddle - React, Tailwind, and code Playground
by leongaban
HTML
<title>jQuery UI Sortable - Display as grid</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
});
</script>
<body>
<div class="my-container">
<ul id="sortable">
<li class="ui-state-default" id="li1">1</li>
<li class="ui-state-default" id="li2">2</li>
<li class="ui-state-default" id="li3">3</li>
<li class="ui-state-default" id="li4">4</li>
<li class="ui-state-default" id="li5">5</li>
</ul>
</div>
<div class="my-red-line"></div>
CSS
body {
width: 100%;
}
.my-container {
position: relative;
width: 500px;
height: 100%;
background: red;
}
#sortable {
list-style-type: none;
margin: 0;
padding: 0;
width: 450px;
}
#sortable li {
float: left;
margin: 3px 3px 3px 0;
padding: 1px;
width: 100px;
height: 90px;
font-size: 4em;
text-align: center;
background: cyan;
}
.my-red-line {
position: relative;
width: 500px;
height: 1px;
background: red;
}
#sortable #li1 {
width: 400px;
}
#sortable #li2 {
width: 400px;
}
#sortable #li3, #sortable #li4, #sortable #li5 {
width: 100px;
}