最後一行Firebug拋出錯誤。我猜這是一個語法問題?我基本上從這個tutorial複製,看不出爲什麼它不起作用。JQuery UI:ui.draggable不是函數
TypeError: ui.draggable is not a function
[Break On This Error]
ui.draggable({ containment: 'body'});
代碼:
function handleDropbox(event, ui) {
$(this).append(ui.draggable); // put this first!!!
ui.draggable.addClass('selected');
$(this).droppable('disable');
ui.draggable.position({ of: $(this), my: 'center center', at: 'center center' });
ui.draggable.draggable('option', 'revert', false);
ui.draggable({ containment: 'parent'});
}
有沒有新增jquery.js和jquery-ui.js?如果添加可以檢查是否加載 – DDK
嘗試添加「(jQuery);」後}); – SamDroid
如果'ui'不是jQuery對象,則需要使用'$(ui)'。所以這取決於你如何將'ui'參數傳遞給'handleDropbox'。 –