2010-09-07 45 views
0

我得到了以下设置为功能的DragDrop: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”用户点击来实现ddragging功能。 这似乎很棘手。我在API中找不到任何东西,所以我非常愿意接受任何肮脏的黑客攻击。

感谢您的所有答案!

回答

1

我已经没有机会来测试这一点,但你能够抓住使用id -

$(ui.draggable).attr("id") 
0

不幸的是,这并不能帮助。我需要知道使用ui.draggable(或实际上:ui.helper)元素中的哪个处理程序。 伪代码:

//return the id of the handler currently used to move the element 
$(":handler", ui.helper).attr("id"); 

不过我已经解决了只需添加另一个拖动元素的问题。这太糟糕了。