jQuery makeDraggable 有更多技巧吗?

发布于 2024-12-02 07:36:44 字数 763 浏览 1 评论 0原文

我已将另一个问题中的脚本添加到我正在使用的解决方案中,以使 jQueryUI 对话框能够拖动到文档原始边界之外

这是脚本:

//Ensure jQuery windows can be pulled outside the browser boundaries.
$.ui.dialog.prototype._makeDraggable = function() {
    this.uiDialog.draggable({
        containment: false
    });
};

问题是,当我添加此脚本时,所有表单都变成了拖动手。这使得当对话框开始拖动操作时尝试滚动对话框时会出现问题。

我怎样才能只将对话框窗口标题栏作为拖动手柄(原始行为),但仍然摆脱遏制?

解决方案:

//Ensure jQuery windows can be pulled outside the browser boundaries.
$.ui.dialog.prototype._makeDraggable = function() {
    this.uiDialog.draggable({
        containment: false,
        handle: ".ui-dialog-titlebar"
    });
};

谢谢约瑟夫!

I've added a script from another question on SO to a solution I'm working with to enable the jQueryUI Dialogs to be dragged outside the documents original boundaries.

This is the script:

//Ensure jQuery windows can be pulled outside the browser boundaries.
$.ui.dialog.prototype._makeDraggable = function() {
    this.uiDialog.draggable({
        containment: false
    });
};

The problem is that when I add this, all of the form becomes a drag-hande. That makes it problematic when trying to scroll a dialog when the dialog begins a drag operation instead.

How can I have just the dialog window titlebar as drag-handle (the original behaviour) but still get rid of the containment?

SOLUTION:

//Ensure jQuery windows can be pulled outside the browser boundaries.
$.ui.dialog.prototype._makeDraggable = function() {
    this.uiDialog.draggable({
        containment: false,
        handle: ".ui-dialog-titlebar"
    });
};

Thank you Joseph!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世态炎凉 2024-12-09 07:36:44

使用拖动手柄查找

Look up using drag handles

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文