我从窗口小部件中删除了一个元素并将其拖动到目标中。像这样:
jQuery('.ui-layout-center').droppable({
activeClass: 'ui-state-hover',
accept: '.item-art',
revert: true,
drop: function (event, ui) {
var $canvas = jQuery(this);
if(!ui.draggable.hasClass('canvas-element')) {
var $canvasElement = ui.draggable.clone();
$canvasElement.addClass('canvas-element');
$canvasElement.html('<div><TEXTAREA COLS=2 ROWS=1></TEXTAREA></div>');
$canvas.append($canvasElement);
$canvasElement.css({
left: (ui.position.left - $canvas.offset().left),
top: (ui.position.top - $canvas.offset().top),
position: 'absolute'
});
$canvasElement.draggable({
cursor: 'move'
});
丢弃后,项目(div)应该可以调整大小。为此我在行$canvasElement.draggable
中使用了resizable:
$ canvasElement.resizable()。拖动({ 光标:'移动' });
但它仍然不起作用。用户无法调整已删除的div的大小。请帮帮我。
答案 0 :(得分:1)
在$canvasElement.resizable();
$canvas.append($canvasElement);