dmivasant,
Вариант решения ...
Сообщение от dmivasant
|
оставался там, куда его положили
|
тащим блоки на цветной квадрат - если нужно корректируем положение упавшего блока
-10 коррекция margin
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>demo</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>
<style type='text/css'>
.wrapper{margin:20px auto}
#block1,#trash{border:solid 1px #555555;margin:10px;padding:20px;-moz-border-radius:5px;-webkit-border-radius:5px;float:left;height:335px ;min-width:100px}
.textBlock{cursor: pointer;border:solid 1px #333333;font-weight:bold;margin:10px 0 5px 0;padding:10px;text-align:center;background:#eee;-moz-border-radius:3px;-webkit-border-radius:3px}
#trash{padding:0px;
width:335px;height:335px ;
background-color: #4169E1;
}
#trash div{
width:40px;height:40px ;
background-color: #DEB887;
position: absolute;
}
</style>
<script type='text/javascript'>
$(window).load(function () {
$("#block1 .textBlock").draggable({
helper: "clone",
appendTo: "#trash"
});
$("#trash").droppable({
accept: "#block1 .textBlock",
drop: function (event, ui) {
var element = $(ui.draggable).clone();
element.css({"top": $(ui.helper).offset().top - 10, "left":$(ui.helper).offset().left})
element.appendTo("#trash")
element.draggable({ containment:"#trash", scroll:false });
}
})
});
</script>
</head>
<body>
<div class="wrapper">
<div id="block1" class="">
<div class="textBlock ui-state-default">Блок 1</div>
<div class="textBlock ui-state-default">Блок 2</div>
<div class="textBlock ui-state-default">Блок 3</div>
<div class="textBlock ui-state-default">Блок 4</div>
<div class="textBlock ui-state-default">Блок 5</div>
<div class="textBlock ui-state-default">Блок 6</div>
</div>
<div id="trash" class=""></div>
</div>
</body>
</html>