I have good news and bad news.
I'll start with the bad news: after examining the object that jQuery returns, the matrix object is nothing more than a string, and there is absolutely no way to get another object than a string. As far as we would like to disagree, it should not be a string: CSS values ββare strings, so jQuery returns strings.
So, whether you like it or not, you really need to parse the string to get the value. The good news: I have two solutions.
Now, if you are VERY sure that the first pair of values ββis ALWAYS the same, you can just use a substring. But, the following problem: in Google Chrome, the value of -283.589px changes to -283.5889892578125 .
Honestly, you need a more advanced string parser to get the correct value. I welcome the regex:
var matrix = $('.selector').css('-moz-transform'); var values = matrix.match(/-?[\d\.]+/g);
Gets all the values ββof your string.
By choosing the correct index, you can get your value:
var x = values[5];
This is the best solution I can provide, and I am sure that this is the only possible solution.
source share