我已将另一个问题中的脚本添加到我正在使用的解决方案中,以便能够将 jQueryUI 对话框拖到文档原始边界之外。
这是脚本:
//Ensure jQuery windows can be pulled outside the browser boundaries.
$.ui.dialog.prototype._makeDraggable = function() {
this.uiDialog.draggable({
containment: false
});
};
问题是,当我添加这个时,所有表单都变成了拖动手。这使得当对话框开始拖动操作时尝试滚动对话框时出现问题。
我怎样才能只将对话框窗口标题栏作为拖动 handle (原始行为),但仍然摆脱遏制?
解决方案:
//Ensure jQuery windows can be pulled outside the browser boundaries.
$.ui.dialog.prototype._makeDraggable = function() {
this.uiDialog.draggable({
containment: false,
handle: ".ui-dialog-titlebar"
});
};
谢谢约瑟夫!
最佳答案
使用drag handles查找
关于javascript - jQuery makeDraggable 有更多技巧吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7230690/