Jquery Draggable UI覆盖了draggable-enabled div中HTML元素的正常浏览器行为
我有一个jquery ui draggable div,由于可拖动,HTML内容的行为不正常。
This text is not selectable. When I try to select it, the popup div is dragged. Lots of text here, vertical scrollbar appears. But clicking the scrollbars don't work (doesn't scroll the content). Each click (mousedown-mouseup) is considered "dragging".
如何防止可拖动的ui覆盖HTML元素的正常浏览器行为?
您可以禁用从内部
拖动,如下所示:
$("#popup div").bind('mousedown mouseup', function(e) { e.stopPropagation(); });
event.stopPrpagation()
停止点击该内部
从冒泡到外部
,该外部
具有绑定到它的拖动事件。 由于事件永远不会到达那里,因此那些拖动事件处理程序不会干扰。 您可以在创建可拖动之前或之后运行此代码,它将以任何方式工作。
尝试添加div unselectable attribute = off:
...
和css:
[unselectable=off] { -moz-user-select : all; -khtml-user-select : all; user-select : all; }
我没有在jQuerry.UI中测试过,但这是我在extJs和Dojo中的解决方法……