How to check the transform rotate in if with java script?
getComputedstyle
Here an Example to get the property of transform...
The issue for this is, that you don't get something like 30deg as return from transform either you get a matrix...
this can be transformed back to your deg -> which i think u wanna know in the end ;)
further information about matrix and calculation
here an online calculator for getting degree's out of a matrix
var rotateStyle = window.getComputedStyle(document.querySelector('.rotate'), null); alert(rotateStyle.transform);
.rotate { display: inline-block; transform: rotate(-90deg); }
<span class="rotate">‹3</span>
In http://jsfiddle.net/ax5nM/108/ a class box
is used – until now for checking for translateX
var t=$(".box").css('transform').split(/[()]/)[1].split(',');
but also makes the properties of the matrix accessible.
some examples what the matrix stands for is to be found here: https://www.w3schools.com/cssref/playit.asp?filename=playcss_transform_matrix
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.