JQuery 可拖动和可调整大小的图像
我在尝试让一些基本的 jquery 功能正常工作时遇到一些问题。
我只是希望能够将一个图像(或多个图像)拖到一个容器中,然后调整它们的大小。
到目前为止,我有这个
我遇到的具体问题是:
1) 无法调整大小手柄以显示在图像边缘周围
2) 一旦您单击图像,它就会直接“跳”到包含 div (#droppable) - 您看不到任何平滑的拖动动画,它只是跳跃直接到div。我想实际上必须将图像“拖”到 contasiment div 中,而不是在单击图像后立即自动跳转。
有什么想法我做错了吗?
I am having a few issues trying to get some basic jquery functionality working correctly.
I simply want to be able to drag an image (or multiple images) into a container and then resize them.
So far I have this
The specific problems I am having are:
1) Can't get resize handles to display around the edge of the image
2) As soon as you click an image it 'jumps' directly into the containment div (#droppable) - You do not see any smooth drag animation, it just jumps directly to the div. I would like to actually have to 'drag' the image into the contasiment div rather than it auto jumping directly in as soon as you click an image.
Any ideas what I am doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
containment 选项“将拖动限制在指定元素或区域的范围内”。
如果您希望图像在放置区内部和外部都可拖动,那么您需要指定一个比可放置 div 更大的容器。
查看可调整大小的代码,只有在右下角添加可见句柄的代码:
因此,看起来当前不支持开箱即用的可见句柄,您可能需要自己添加该功能。
The containment option "Constrains dragging to within the bounds of the specified element or region."
If you want the images to be draggable, both inside and outside the dropzone, then you need to specify a container larger than just the droppable div.
Looking at the code for resizable, there is only code to add the visible handle on the lower right corner:
So, it doesn't look like the visible handles are supported currently out of the box, you may need to add that functionality yourself.