I'm trying to position a hidden div, then show it, and then rotate it with some animation.
Here's what I got so far, which doesn't seem to rotate it at all...
$(this).css({ 'left' : randomNum(offsetStartX, offsetEndX),
'top' : randomNum(offsetStartY, offsetEndY) });
$(this).show("fast");
var cssObj = {
msTransform: 'rotate(\'+ rotDegrees + \'deg)',
'-moz-transform' : 'rotate(\'+ rotDegrees + \'deg)',
'-webkit-transform' : 'rotate(\'+ rotDegrees + \'deg)',
'-o-transform' : 'rotate(\'+ rotDegrees + \'deg)',
'transform' : 'rotate(\'+ rotDegrees + \'deg)' };
$(this).animate(cssObj, "slow");
If I place the CSS for left
and top
into var cssObj
, it rotates it just fine. However, I need it to be positioned, then set to visible, and then rotated with an animation.
How can I do this?