ドロップ可能なターゲットにドロップされた jQuery ウィジェットのコンテキストを取得するにはどうすればよいですか?
たとえば、これはこのコードでドラッグ可能にされたウィジェットです:
In the code that makes the images be draggable
ContentImageHolder.prototype = {
options: {
contentInfo: null,
},
getContentInfo: function(){
return this.options.contentInfo;
},
makeContentDraggable: function(){
$(this.element).draggable({
revert: true,
scroll: false,
start: $.proxy(this, 'dragStart'),
stop: $.proxy(this, 'dragStop'),
});
},
_init: function() {
this.makeContentDraggable();
}
$.widget("basereality.contentImageHolder", ContentImageHolder);
そして、これはゴミ箱が画像を受け入れることができるようにする私のコードです。
TrashCan.prototype = {
trashContent: function (event, ui){
//What do I do here to be able to access the functions of the dropped object
//droppedObject.getContentInfo();
},
_init: function() {
$(this.element).droppable({
drop: $.proxy(this, 'trashContent'),
});
},
}
$.widget.bridge('trashCan', TrashCan);
オブジェクトで関数を呼び出すことができるように、ドロップ可能にドラッグされた ContentImageHolder のコンテキストを取得することは可能ですか?
同様のキーワードを使用したここでのすべての質問はすべて使用するように言っていますui.draggable
が、jQuery ウィジェットではなく DOM オブジェクトを参照しています。jQueryウィジェットを取得することは可能ですか?