jQuery Animate 1.6
Backward compatibility without using units (px)
CSS
div{
width:200px;
height:200px;
margin-left:-100px;
margin-top:-100px;
opacity:1;
background:#333;
position:absolute; left:50%; top:50%;
}
JavaScript
;(function($) {
var slowingCoeff = 10;
jQuery.fx.speeds = {
slow: slowingCoeff * 600,
fast: slowingCoeff * 200,
_default: slowingCoeff * 400
};
var oAnimate = $.fn.animate;
$.fn.animate = function(prop, speed, easing, callback) {
if(typeof speed === "number")
speed *= slowingCoeff;
return oAnimate.call(this, prop, speed, easing, callback);
}
})(jQuery);
$('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);