I have the follow code that allows me to drag a div into 3 boxes.
I am trying to get the draggable div to fit in the box from onces you dropped on to it, Because at the moment it will drop onit it but it allows it to be dropped anywhere on the window how can i stop that from happening?
<div id="drop1" class="dropzone">Accepts the element if fits inside</div>
<div id="drop2" class="dropzone">Accepts the element if intersects</div>
<div id="drop3" class="dropzone">Accepts the element if pointer hovers</div>
<div id="drag" class="dropaccept">Drag me</div>
<script type="text/javascript">
$(document).ready(
function()
{
$('#drag').Draggable();
$('#drop1').Droppable(
{
accept : 'dropaccept',
activeclass: 'dropactive',
hoverclass: 'drophover',
tolerance: 'intersect'
}
);
$('#drop2').Droppable(
{
accept : 'dropaccept',
activeclass: 'dropactive',
hoverclass: 'drophover',
tolerance: 'intersect'
}
);
$('#drop3').Droppable(
{
accept : 'dropaccept',
activeclass: 'dropactive',
hoverclass: 'drophover',
tolerance: 'intersect'
}
);
}
);
</script>