Probabely this is a very simple question but i am a beginner in Jquery...
I have following Script:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js">/script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.js">
</script>
<script>
$(function() {
$('li').draggable({
containment: 'document',
revert: true
});
$("#config").droppable({
drop: function(event, ui) {
$(ui.draggable).appendTo( "#schub" );
}
});
});
</script>
And this is what my Body contains:
<div style="width:1800px; height:600px; background-color:#efefef;padding:10px;" >
<div style="float:left; width:1250px; height:580px; border:1px solid grey; padding:10px;" >
<div id="config" style="background-color:blue; border:1px solid black; width:700px; height:500px;">
<ul id="schub" style="width:300px; height:500px;"></ul>
</div>
</div>
<div style=" background-color:red;float:left; width:490px; height:580px; border:1px solid grey; margin-left:10px;padding:10px;" id="menu">
<ul class="category">
<li class="dragg" style="background-color:#e6e6e6; border:1px solid black; width:150px; height:98px;">
</li>
<li class="dragg" style="background-color:#e6e6e6; border:1px solid black; width:150px; height:98px;">
</li>
<li class="dragg" style="background-color:#e6e6e6; border:1px solid black; width:150px; height:98px;">
</li>
</ul>
</div>
Now my issue: I want to be able to drag the grey <li>
from the red <div>
into the blue <div>
. It actually works but the grey <li>
are always reverting from outside of the window into the blue <div>
when i drop them. Why is that happening?? Isnt it posible that my <li>
revert from where i drop them?
Thanks very much for your help!