Demo jQuery UI sortable() : horizontal
by Adi Jaya
HTML
<div class="panel-container" id="panel-container">
<span class="panel-tab">index.php</span>
<span class="panel-tab">demo.php</span>
<span class="panel-tab">hello.php</span>
<span class="panel-tab">note.md</span>
</div>
<p>Hello...</p>
CSS
html {
font-family: sans-serif;
font-size: 16px;
}
body {
cursor: auto;
margin: 0;
font-family: sans-serif;
font-size: 1em;
}
.panel-container {
display: flex;
padding: 10px;
clear: both;
overflow: auto;
background: #585858;
}
.panel-tab, .panel-tab-highlight {
position: relative;
margin-right: -1px;
display: inline-block;
float: left;
padding: 2px 12px;
color: #fff;
border: 1px solid silver;
font-size: 13px;
background: red;
}
.panel-tab-highlight {
background: silver;
}
.panel-tab-highlight::before {
display: block;
content: "\00a0\00a0";
min-width: 55px;
}
JavaScript
$( "#panel-container" ).sortable({
placeholder: "panel-tab-highlight",
items: ".panel-tab",
opacity: 0.8,
cursor: "move",
cursorAt: { right: 5 }
});
$( "#panel-container" ).disableSelection();