CSS转换尚无法与jQuery动画化。您可以执行以下操作:
function AnimateRotate(angle) {
// caching the object for performance reasons
var $elem = $('#MyDiv2');
// we use a pseudo object for the animation
// (starts from `0` to `angle`), you can name it as you want
$({deg: 0}).animate({deg: angle}, {
duration: 2000,
step: function(Now) {
// in the step-callback (that is fired each step of the animation),
// you can use the `Now` paramter which contains the current
// animation-position (`0` up to `angle`)
$elem.css({
transform: 'rotate(' + Now + 'deg)'
});
}
});
}
而且,顺便说一句:您不需要在jQuery 1.7+之前为CSS3转换添加前缀