![](/img/trans.png)
[英]Change color of dropped item and limit item after its dropped in jquery
[英]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.