title: jquery animation - move a object from a div to another
body: <p>I found this <a href="https://stackoverflow.com/questions/9153147/is-it-possible-to-move-the-text-from-an-element-to-another-using-jquery-animatio">Is it possible to move the text from an element to another using jquery animation?</a> that is almost what I was looking for, but what I really cannot do is to obtain a smooth animation during the movement in my little different case.
  Here the not-so-working example: <a href="http://jsbin.com/ofumil/7/edit" rel="nofollow noreferrer">http://jsbin.com/ofumil/7/edit</a></p>
  
  <p>The button in the second tab should move from the tab to the upper div (where you see "selected").</p>
  
  <p>Can anybody understand my error?
  Thanks</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/&gt;
    &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&gt;    &lt;/script&gt;
    &lt;!-- &lt;script src="./elgg/vendors/jquery/jquery-1.6.4.min.js"&gt;&lt;/script&gt; --&gt;
    &lt;script&gt;
      $(document).ready(function() {
        $("#tabs-left").tabs();
        $(".category").click(function(){
          changeDiv('#go', '#fragment-2', '#selicons');
          changedest();
        });
      });
  
  
      function changeDiv(what, source_id, target_id)
      {
      var clickedButton = $(what);
      var soff = $(source_id).offset();
      var eoff = $(target_id).offset();
      $('&lt;div id="anim-shell"&gt;&lt;/div&gt;').appendTo('body');
      $('#anim-shell').css( "background-color","yellow" );
      $('#anim-shell').css( { top: soff.top, left: soff.left } );
      clickedButton.appendTo('#anim-shell');
      $('#anim-shell').animate( { top: eoff.top+'px', left: eoff.left+'px' }, 1500, function() {
          clickedButton.appendTo(target_id)
          $('#anim-shell').remove();
  
          //$(target_id).text( _text );
      });
  }
      function changedest(){
        document.getElementById("dest").href ="nuovohref.html"
      }; 
  
    &lt;/script&gt;
    &lt;style&gt;
  
      #go{background-image:url('invia.gif');
      background-repeat:no-repeat;
      background-position:center center;
      width:100px;height:44px;
      background-color:0000ff;}
      //vertical tabs
      div#tabs-left {
          position: relative;
          padding-left: 200px;
      }
  
      div#tabs-left &gt; div {
          min-height: 300px;
      }
  
      div#tabs-left .ui-tabs-nav {
          position: absolute;
          left: 0px;
          top: 0px;
          bottom: 0px;
          width: 195px;
          padding: 5px 0px 5px 5px;
      }
  
      div#tabs-left .ui-tabs-nav li {
          left: 0px;
          width: 195px;
          border-right: none;
          overflow: hidden;
          margin-bottom: 2px;
      }
  
      div#tabs-left .ui-tabs-nav li a {
          float: right;
          width: 100%;
          text-align: right;
      }
  
      div#tabs-left .ui-tabs-nav li.ui-tabs-selected {
          border: none;
          border-right: solid 1px #fff;
          background: none;
          background-color: #fff;
          width: 200px;
      }
  
      .content {
      position:relative;
      left:200px;
      background-color: #bcf;
      }
    &lt;/style&gt;
  &lt;/head&gt;
  &lt;body &gt;
  &lt;div id="selicons"&gt;
    &lt;br&gt;
    selected:&lt;br&gt;
    &lt;br&gt;
    &lt;button id="search" &gt;» trova&lt;/button&gt;
    &lt;a href="oldlink.htm" id="dest"&gt;link&lt;/a&gt;
  &lt;/div&gt;
  &lt;div id="tabs-left"&gt;
      &lt;ul&gt;
          &lt;li&gt;&lt;a href="#fragment-1"&gt;&lt;span&gt;One&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#fragment-2"&gt;&lt;span&gt;Two&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="#fragment-3"&gt;&lt;span&gt;Three&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
      &lt;div class= "content" id="fragment-1"&gt;
          &lt;p &gt;First tab is active by default:&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class= "content" id="fragment-2"&gt;
          &lt;button id="go" class="category" style="position: absolute;left:100px;top:20px"&gt;&lt;/button&gt;
          &lt;button id="go1" class="category" style="position: absolute;left:100px;top:20px"&gt;&lt;/button&gt;
  
      &lt;/div&gt;
      &lt;div class= "content" id="fragment-3"&gt;
          Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
          Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
          Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/html&gt; 
  </code></pre>