How can i get the currently applied CSS
property-identifiers from an element (excluding the value)?
Or rather: How to get the elements e.g. translate
, skew
, rotate
or rect
? I don't mean the complete returned string like: rect(300px 0px 0px 300px)
. I mean just the property-identifiers
...
I'm not a really familiar with RegExp but maybe can that do the trick?
So for better interpretation purposes:
I need to check for that, change some values (via matrix-array) and reapply them back to the element again.
// http://stackoverflow.com/a/5968313/1250044
function matrixToArray(matrix) {
return matrix.substr(7, matrix.length - 8).split(', ');
}
$("#foo").css("clip","rect(300px 0px 0px 300px)");
var matrix = matrixToArray($("#foo").css("clip"));
// If `#foo` has something else
// applied than `clip`, then
--- ˅ --- // is that not really dynamically
$("#bar").css("clip", "rect(" + matrix[0] + matrix[1] + matrix[2] + matrix[3] + ")");