简体   繁体   中英

Rotation value of image as its dragged

I have an image of an arrow that the user can rotate by clicking and dragging it.

Using jQuery or Js, how could I get the rotation value (in degrees) as it's being dragged?

I tried $('.el').css("-moz-transform") but all I get is a matrix of values I cant really use: matrix(0.721445, 0.190526, -0.190526, 0.721445, 0px, 0px)

Here is a fiddle: http://jsfiddle.net/Lad6q3sk/

You can get the actual transform style like this:

$('.draggable_wp')[0].style.transform;

Which will return something like:

"rotate(-17.2931deg)"

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM