Drag N Drop layout Test
Basic test for drag and drop of items on a page
by parkji
HTML
<div class="container">
<div class="col">
</div>
</div>
<div class="container">
<div class="one-third col">
<div class="moveable">
</div>
</div>
<div class="one-third col">
</div>
<div class="one-third col">
</div>
</div>
<div class="container">
<div class="col">
</div>
</div>
CSS
body {
padding: 50px 100px;
}
.container {
height: 200px;
margin-bottom: 20px;
margin-left: -40px;
width: 620px;
overflow: hidden;
}
.col {
border: 1px dashed #aaaaaa;
float: left;
margin-left: 20px;
height: 90%;
width: 94%;
}
.one-third {
width: 29%;
}
.push-end {
float: right;
}
.moveable {
background: #F00;
height: 50%;
width: 50%;
}
.ph {
background: rgba(0, 0, 0, 0.3);
height: 100%;
width: 100%;
}
JavaScript
$('.col').sortable({
items: '.moveable',
connectWith: $(".col"),
accept: '.moveable',
opacity: 0.5,
placeholder: 'ph',
cursorAt: {top: 50, left: 50}
});