jQuery - CSS - 通过拖动鼠标事件旋转 Div
我几天来一直在搜索,但没有真正的结果,也许有人可以帮助我。
我的页面上有一个 div(可以包含图像、文本区域等),它是可拖动和可调整大小的(感谢 jQuery UI),我想让它“可旋转”,角落里有一个手柄可以拖动并使用 css 变换(-wekbit-transform,moz-transform)旋转它,
这可能吗?使用 jQuery 或其他 Javascript ?
其实我并不关心与IE的兼容性。
提前致谢, 问候
I'm searching since a few day without real result, maybe someone can help me here.
I've a div on my page (can containt an image, a text area, other), it's draggable and resizable (thanks to jQuery UI), and i want to make it "rotatable", with a handle in a corner to drag and rotate it using css transform (-wekbit-transform, moz-transform)
Is it possible ? with jQuery or other Javascript ?
Actually i don't care of compatibility with IE.
Thanks in advance,
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 jQuery UI 的原始拖动事件:
问题是您的问题不太清楚如何处理由此产生的两种行为(当您拖动对象时旋转和移动)的冲突。这个只是让鼠标的左右移动来决定旋转多少,而默认的拖动行为(移动)仍然存在。
编辑:
我想这有点黑客,但它会起作用:
Using jQuery UI's original drag events:
The problem is that your question is slightly unclear about how the conflict about the two behaviors (when you drag the object both rotates and moves around) that arise from this is handled. This one just let the left-right movement of the mouse determine how much to rotate, while the default drag behavior (movement) still exists.
Edit:
I suppose this is a little hackish but it will work: