Jquery Draggable:如何在拖动时使组件变小?
我有一个可拖动的图像可以放置在一个较小的可放置图像上。 我想在拖动时缩小图像以在视觉上适合目标, 所以在我使用的开始事件上:
start: function() {
$("#primage").css({'width':'80px','height':'auto'});...
问题是,当拖动开始时,光标根据初始图像大小定位,因此它超出了现在较小的图像(较高且左侧)。 我尝试将光标左选项设置为更靠右以适应宽度的变化,但是当图像位于其上方但更靠右时,可放置的 over 事件不会触发。
如何根据新的图像大小设置光标,或者您可以建议其他解决方案吗?
I have a dragable image to be dropped on a smaller dropable.
I would like to make the image smaller while dragging to visually fit in the targer,
so on the start event I use:
start: function() {
$("#primage").css({'width':'80px','height':'auto'});...
The problem is that when the dragging starts, the cursor is positioned according to the initial image size, so it is out of the now smaller image (higher and to the left).
I tried setting the cursorat left option further to the right to accommodate the change of width but then the over event of the dropable does not fire when the image is over it but further to the right.
How can I set the cursorat according to the new image size or can you suggest another solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您可以将图像定位在光标位置,而不是尝试定位光标本身。
Perhaps you could position the image at the cursor location instead of trying to position the cursor itself.