2010-09-07 20 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"); 

不過我已經解決了只需添加另一個拖動元素的問題。這太糟糕了。

相關問題