[英]Build roulette using jQuery and CSS3 rotation
I'm trying to build a roulette to be controlled by the mouse, I'm not using canvas or svg but only CSS3 rotation and some jQuery. 我正在尝试构建一个由鼠标控制的轮盘赌,我不是使用canvas或svg而是仅使用CSS3旋转和一些jQuery。
What I want to achieve is when the mouse is over the roulette and he is clicked and holds down, I want the user to be able to rotate the wheel when he moves the mouse up and down. 我想要实现的是当鼠标位于轮盘上并且他被点击并按住时,我希望用户能够在他上下移动鼠标时旋转轮子。 I'm using the
event.offsetY
to get the position of the mouse and according to this position I'm moving the roulette with or against the clock. 我正在使用
event.offsetY
获取鼠标的位置,根据这个位置,我正在用时钟移动轮盘。
The problem is that I think the mouse offset position is changing according to the rotation of the wheel, is their a way to keep the mouse offset position "real" with the document? 问题是我认为鼠标偏移位置是根据轮子的旋转而改变的,是他们用文件保持鼠标偏移位置“真实”的方法吗?
-Or- -要么-
Someone know a better idea to accomplish that? 有人知道更好的想法来实现这一目标吗?
Please see the code here: http://jsfiddle.net/MZxgp/ (works on chrome only) 请在此处查看代码: http : //jsfiddle.net/MZxgp/ (仅适用于chrome)
Many thanks! 非常感谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.