Draggables Jquery UI, disable individual div on droppable

萝らか妹 提交于 2019-12-04 12:25:30

You're just putting the right code in the wrong place.

$( "#draggable" ).draggable( "option", "disabled", true )

The above will work on it's own and turn off draggable for #draggable, no need to put it in the drop function.

OR:

$("#droppable").droppable({
  disabled: true
});

Either will work.

This can be achieved by defining a scope to both draggables and droppable area:

$(function() {
    $('.drag').draggable({
        revert: "invalid",
        scope: "items"
    });
    $('#droppable').droppable({
        scope: "items"
    });
});

Example Link.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!