문제

Considering this element:

<div style="transform:rotate(9deg) scale(3) translate(20px,10%) skew(-11deg)"></div>

I'd like to add another transformation translate(5px) but before all others (ie: "prepend"):

<div style="transform: rotate(9deg) scale(3) translate(20px,10%) skew(-11deg)"></div>
                      ^
                 translate(5px)

How can I script this with javascript/jQuery?

도움이 되었습니까?

해결책

Yes, even though the style is originally declared by individual transforms, when you retrieve the transform thru javascript, you get a matrix.

No problem, just set the transform with the matrix

<div style="transform: translateX(5px) matrix(values get from javascript)">
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top