Many css3 have added many attributes, and it is not as convenient as it was before during reading and writing.
For example:
<Div style = "Left: 100px"> </div>
If you only consider the line style, you only need Div. style. Left to get it. You only need Div. style. Left = '100px 'to set it. Very simple.
But css3 is coming.
For example:
<Div style = "-WebKit-transform: translate (20px,-20px)"> </div>
What should I do? Scared...
The setting is simple:
Div. style. webkittransform = 'translate (20px,-20px) 'follow the camper style.
When obtaining:
Div. style. webkittransform is the string 'translate (20px,-20px )'
How can I obtain the desired x and y values? No simple method was found for searching for half a day. Only string truncation or regular matching are supported.
Write a regular expression to get the expected 20 and-20
Reg = /\-? [0-9] +/g match the negative number and number
Reg2 = /\-? [0-9] + \.? [0-9] */G may contain the decimal point
Search for the match
Div. webkittransform. Match (REG) // result [20,-20]
An array containing the x and y values is returned.
Likewise:
-WebKit-transform: skew (20deg,-50deg);/* skew (skewed relative to the X axis and skewed relative to the Y axis )*/
-WebKit-transform: matrix (1, 0.4 );
Various...