jQuery UI拖动-正在使用哪个处理程序?
我获得了dragdrop功能的以下设置:jQuery UI拖动-正在使用哪个处理程序?,jquery,user-interface,drag-and-drop,handle,Jquery,User Interface,Drag And Drop,Handle,我获得了dragdrop功能的以下设置: 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
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”中的哪一个来实现ddragging功能。
这似乎很棘手。我在API中找不到任何东西,所以我真的愿意接受任何肮脏的攻击
谢谢你的回答 我还没有机会测试这个,但是你能用-
$(ui.draggable).attr("id")
不幸的是,这没有帮助。我需要知道
ui.draggable
(或者实际上:ui.helper
)元素中使用的是哪个处理程序。
伪代码:
//return the id of the handler currently used to move the element
$(":handler", ui.helper).attr("id");
然而,我已经通过添加另一个可拖动元素解决了这个问题。但这太糟糕了