jQuery UI 拖动 - 正在使用哪个处理程序?
我对拖放功能进行了以下设置:
const listDragOptions = {
handle: ".camera, .texter", // dragged by either camera or edit icon
//revert: true, // so dragged elements fall back to their original position,
revertDuration: 200, // the element goes back instantly, no need for effects on this one
snap: true, // snap to table cell edges
helper: "clone", // create a cloned element instead of moving the original one
drag: function(event, ui) {
// tell me which handle is being used!
}
}
基本上我需要知道用户单击了两个句柄“.camera、.texter”中的哪一个来实现拖放功能。 这看起来很棘手。我在 API 中找不到任何东西,所以我真的愿意接受任何肮脏的 hack。
感谢您的所有回答!
I got the following setup for dragdrop functionality:
const listDragOptions = {
handle: ".camera, .texter", // dragged by either camera or edit icon
//revert: true, // so dragged elements fall back to their original position,
revertDuration: 200, // the element goes back instantly, no need for effects on this one
snap: true, // snap to table cell edges
helper: "clone", // create a cloned element instead of moving the original one
drag: function(event, ui) {
// tell me which handle is being used!
}
}
Basically I need to know which of the two handles ".camera, .texter" the user has clicked to achieve ddragging functionality.
This seems tricky. I can't find anything in the API, so I'm really willing to accept any dirty hack.
Thanks for all answers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我还没有机会测试这个,但是你可以使用 - 获取 id 吗?
I've not had chance to test this, but are you able to grab the id using -
不幸的是,这没有帮助。我需要知道正在使用
ui.draggable
(或实际上:ui.helper
)元素内的哪个处理程序。伪代码:
但是我通过添加另一个可拖动元素解决了问题。但这也太糟糕了。
Unfortunately, this doesn't help. I need to know which handler inside the
ui.draggable
(or actually:ui.helper
) element is being used.Pseudo-Code:
However I have solved the problem by just adding another draggable element. It's too bad though.