簡體   English   中英

使用jQuery / Ember框架訪問刪除的項目

[英]Accessing dropped item with jQuery/Ember framework

我正在使用ember.js和jQuery-ui框架。 目前,我能夠將元素拖放,並且可以在將項目放入特定div時觸發事件。

但是,我無法獲取放置到div上的實際元素。 傳入的事件變量表示放置元素的div,“ this”表示余燼對象。

我如何訪問被丟棄的物品?

我正在使用的代碼概述:

App.MyView = Em.View.extend({
    ...
    drag: function (event) {
        // This works correctly and the event here represents the actual element
        console.log("Dragging");
    },
    drop: function (event) {
        // This is where I am not able to access the dropped iem
        console.log("Dropped");
    },
    ...
});

謝謝

如果您使用的是jQuery ui.draggable / ui.draggable ,則ui.draggable應該是您想要的。

http://jqueryui.com/demos/droppable/#event-drop

drop: function(event, ui) { ... }

在回調中,$(this)表示可拖動對象放置在其上的可放置對象。 ui.draggable表示可拖動。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM