简体   繁体   English

无法禁用jQuery UI中的Droppable

[英]can't disable droppable in jquery ui

I am using jquery ui Draggable and Droppable in my web application to drag divs and drop them, 我在Web应用程序中使用jQuery ui Draggable和Droppable来拖放div,

But when I drop the items on the droppale area (they are sometimes textboxes or textareas) I can't react with them any more or drag them further, its like they are consumed in that part of the page. 但是,当我将项目放到droppale区域(有时是文本框或文本区域)时,我无法再与它们反应或将其进一步拖动,就像它们在页面的那部分被消耗一样。

other thing is that I decided to totaly disable the droppable but still the div keeps dropping stuff on it and consuming them, i tried also to delete the droppable event from the code and run it again still the same thing keeps happenning. 另一件事是,我决定完全禁用droppable,但div仍然在上面放下东西并使用它们,我也尝试从代码中删除droppable事件,然后再次运行它,但仍然发生同样的事情。

but when i drag them to other parts of the page the drag works fine. 但是当我将它们拖动到页面的其他部分时,拖动效果很好。 I also tried to run on several machines but still same output. 我也尝试在多台机器上运行,但输出仍然相同。

what could be the cause of the problem ? 可能是什么原因造成的?

code for creating the draggables 用于创建可拖动对象的代码

$('body').append("<div id='addNewText'></div>");
    $("#addNewText").draggable();

code for creating the droppable page but when I deleted the droppable part. 创建可放置页面的代码,但是当我删除可放置部分时。

$("#book").append("<div name=\"page\" id =\"page"+(pagesNumber+1)+"\"> </div>");
    $("#page"+(pagesNumber+1)).css("position","absolute");

尝试设置“禁用”属性,如下所示:

$("#addNewText").droppable('option', 'disabled');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM