开发者

reactivate a disabled draggable div jquery

开发者 https://www.devze.com 2023-04-06 01:55 出处:网络
I have a div and after dropping it at a new location, this action will be triggered: function handleActionDrop(event, ui) {

I have a div and after dropping it at a new location, this action will be triggered:

function handleActionDrop(event, ui) {

    // can not be dragged
 开发者_开发百科   ui.draggable.draggable('disable'); 

    // only one is allowed to be dropped
    $(this).droppable('disable');      

    // set to the new position
    ui.draggable.position({ of: $(this), my: 'left top', at: 'left top' });  

    // disable the revert of the selected div
    ui.draggable.draggable('option', 'revert', false);
}

After I double click on that div, the div will be moved back to the initial position (done). However, if I set that div to have the same behavior that it can be dragged, then it does not work. I tried to do it like this: $(theDiv).draggable();

Is there any way to reset the div to have the same behavior as the starting state? or is there a way to reactivate the disabled draggable div?

Thanks in advance.

0

精彩评论

暂无评论...
验证码 换一张
取 消