*js获取元素css3的transform
window.onload=function (){
var el = document.getElementById("dsiv");
var st = window.getComputedStyle(el, null);//获取外部或style中的css
var tr = st.getPropertyValue("-webkit-transform") || //获取外部或style中的css中的数据
st.getPropertyValue("-moz-transform") ||
st.getPropertyValue("-ms-transform") ||
st.getPropertyValue("-o-transform") ||
st.getPropertyValue("transform") ||
"FAIL";
var values = tr.split('(')[1].split(')')[0].split(',');//分类下面这方法是用于获取旋转旋转角度值
var a = values[0];//各个参数
var b = values[1];
var c = values[2];
var d = values[3];
var e = values[4];
var f = values[5];
var scale = Math.sqrt(a * a + b * b);
var sin = b / scale;
var angle = Math.round(Math.atan2(b, a) * (180 / Math.PI));
console.log('Rotate: ' + angle + 'deg');
// 这里的转载链接写了我自己,这是一篇老文章了,现在来更新一下,但提交机制改了,需要完善才能提交,但出处已经无法找到了。
}