问题描述:

I have some elements which are draggable.

you can check here

I want to freeze these elements after dropping into particular container. you can say that i have to drop one element into one block, it cannot be dropped to other blocks.

function handleDropEvent (event, ui) {

if ($(this).hasClass('occupied')) {

ui.draggable.draggable('option', 'revert', true);

return false;

}

$(this).append(ui.draggable);

ui.draggable.position({of: $(this), my: 'left top', at: 'left top'});

ui.draggable.css('z-index', 0);

setTimeout(validateDropzones, 0);

}

网友答案:

Call ui.draggable('destroy') in your drop handler: http://jsfiddle.net/SRPm2/41/

function handleDropEvent (event, ui) {
  // ...
  ui.draggable.draggable('destroy');
}
相关阅读:
Top