繁体   English   中英

CSS转换矩阵是左还是顶?

[英]css transform matrix get left or top?

计算左还是顶?

 <div style="width:100px;height:50px;"></div>
 div.style.transform = `rotateZ(45deg)`
 // 获取矩阵
 let transform = window.getComputedStyle(div)['transform'],
     matrix = transform.slice(7, -1).split(',')

要使用javascript获取div的矩阵,您可以尝试这些

let style = window.getComputedStyle(div);
let transform = style.transform;
let matrix = transform.replace('matrix(', '').replace(')','').split(',')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM