title: JQueryUI: drop within container, append and revert
body: <p>I got stuck with JQueryUI. Specifically, I have the following html snipped:</p>
  
  <pre><code>&lt;div class="from"&gt;
   &lt;div class"item"&gt;Item 1&lt;/div&gt;
   &lt;div class"item"&gt;Item 2&lt;/div&gt;
   &lt;div class"item"&gt;Item 3&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="to"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Now I want to make the items draggable and droppable on the "to" box via the JQueryUI library. Therefore, I use this javascript snippet:</p>
  
  <pre><code>$('.item').draggable({
    revert: true
  });
  
  $('.to').droppable({
    drop: function(event, ui) {
      ui.draggable.appendTo(this);
    }
  });
  </code></pre>
  
  <p>While this works perfectly as far as the result is concerned, the animation handling the 'revert' doesn't behave as I want it to. The problem is that dragging is obviously implemented by setting "position: relative" and then changing 'top' and 'left' css properties. As soon as the item is attached to the new container (which happens before the revert animation), it jumps to a new position because it's now positioned relatively to the new container. The revert animation now starts at the new position.</p>
  
  <p>Is there any way I can have a smooth revert animation after attaching the item to a new container? Perhaps I am going about this completely the wrong way, so please don't hesitate to suggest any different approach.</p>
  
  <p>I have been trying to recalculate the css left and top properties based on the new containers absolute position, but this of course works only for the first dropped item, the second one would additionally have to consider the first item's position.</p>
  
  <p>Thanks.</p>