title: JQuery animate .css() rather then using .anmiate()?
body: <p>I want to aniamte the change of the margin-top of a div.</p>
  
  <p>Normally I would so this as such:</p>
  
  <pre><code> $("#mydiv").animate({ marginTop: '+='+myvar}, 200);
  </code></pre>
  
  <p>But this always adds (or subtracts) the value. I want a way to simply aniamte the <em>change</em> in value.</p>
  
  <p>For example: if the div starts of with a margin top of 100 and myvar value is 50 I want to animate the div so it shrinks back to 50. Likewise if the myvar value is 200 I want to animate the change so grows to 200.</p>
  
  <p>I can achieve this somewhat but resetting the CSS, eg:</p>
  
  <pre><code>$("#mydiv").css("margin-top", "0px");
  $("#mydiv").animate({ marginTop: '+='+myvar}, 200);
  </code></pre>
  
  <p>each time but that makes it a bit clunky.</p>
  
  <p>Does anyone know of a may to achieve this?</p>
  
  <p>(Ps: without using CSS transitions)</p>
  
  <p>EDIT: Added my code below</p>
  
  <pre><code>$("#info1tab").click(function() {
    $(".textbox").slideUp('200');
    $("#info1").delay(300).slideDown('200');
    var itemheight = $("#info1").css("height");
    var itemheightint = parseInt(itemheight);
    $("#photobox").animate({ marginTop: itemheightint }, 200);
  
  });
  
  $("#info2tab").click(function() {
    $(".textbox").slideUp('200');
    $("#info2").delay(300).slideDown('200');
    var itemheight = $("#info2").css("height");
    var itemheightint = parseInt(itemheight);
    $("#photobox").animate({ marginTop: itemheightint }, 200);
  
  });
  </code></pre>