Q:

$.css('transform') return wrong value rotate

Possible Duplicate:
Get element -moz-transform:rotate value in jQuery 

Firefox 15 - Chrome:
$('#img2').css('transform');

return =>  "rotate(90deg)"

Firefox 16
$('#img2').css('transform');
return => matrix(0, 1, -1, 0, 0, 0);

Any idea how to get rotate value in firefox 16
What is matrix ?
In Firebq i get:
element.style {
    height: auto;
    transform: rotate(90deg);
    width: auto;
}

A:

A matrix is an affine transformation in the form [a,b,c,d,tx,ty]. If you parse the css string into an object with those properties (respectively [0,1,-1,0,0,0] in your example), then you can calculate the angle of rotation in degrees by doing: Math.atan2(matrix.b,matrix.a) * (180 / Math.PI);
There's a good article on the css matrix here http://dev.opera.com/articles/view/understanding-the-css-transforms-matrix/ - but still the best explanation I've found is this one by Senocular (even though it's meant to be about Flash, the basic math is the same): http://www.senocular.com/flash/tutorials/transformmatrix/
The rotate(deg) syntax is just a shorthand for the underlying matrix transform. I'm not sure why FF accepts one format, but reports another. 
More on transforms: http://www.w3.org/TR/2012/WD-css3-transforms-20120911/

