Jquery droppable
by ozzon91
HTML
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<div class="c">
<div class="area">
<ul id="u1" class="inside">
<li class="dragg">1</li>
</ul>
</div>
<div class="area">
<ul id="u2" class="inside">
<li class="dragg">2</li>
</ul>
</div>
</div>
SCSS
.dragg {
width: 50px;
height: 50px;
background: red;
}
.hov {
background: #333 !important;
}
.c {
overflow: hidden;
.area {
width: 200px;
height: 200px;
float: left;
background: blue;
margin: 10px;
overflow: auto;
.inside {
width: 500px;
height: 500px;
background: tan;
}
}
}
JavaScript
$(function() {
$( "#u1, #u2" ).sortable({
connectWith: ".inside",
helper: "clone",
containment: '.c',
appendTo: '.c',
over: function(e, ui) {
console.log(1);
},
}).disableSelection();
});