jQuery Animate 1.6

Backward compatibility without using units (px)

by fparent

HTML

<div></div>

CSS

div{
    width:200px;
    height:200px;
    margin-left:-100px; 
    margin-top:-100px;
    opacity:1;
    background:#333;
    position:absolute; left:50%; top:50%;
}

JavaScript

$('div').animate({
    marginLeft: "-200",
    marginTop: "-200",
    width: "400",
    height: "400"
    // Comment the line below to see difference
    ,opacity: 0.5
}, 2000).animate({
    marginLeft: -150,
    marginTop: -150,
    width: 300,
    height: 300
    // Comment the line below to see difference
   ,opacity: 1
}, 2000);