javascript - jquery 对话框 : drag dialog at any point

标签 javascript jquery-ui draggable

是否有技巧可以使 jquery 对话框在任何时候都可以拖动? (我的意思不仅是在标题栏中)

最佳答案

与可排序项相反,对话框项没有该功能(我不确定为什么)。如果需要,您可以执行以下操作:

$(document).ready(function() {
    var
        // Create dialog
        dialog = $('div')
            .dialog({ title: "I'm a dialog" })
            .css({cursor: 'move'}),

        // Get the options manually
        options = dialog
            .data("dialog")
                .uiDialog
                .data('draggable')
                    .options;

    // Finally, extend the draggable modal box's
    // options and remove any restrictions
    $.extend(options, {cancel: '', handle: ''});
});

请在此处查看工作示例:http://jsfiddle.net/gMP2d/

关于javascript - jquery 对话框 : drag dialog at any point,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3344693/

相关文章:

javascript - 仅对参数中的数字求和

jquery - 使用 jQuery 的甘特图

Jquery可拖动问题

javascript - 当输入框字符串长于框大小时,Vue Sortable + Draggable 不起作用

jquery - 如何防止触发多个 jQuery UI droppables?

javascript - 如何让滚动条在下面的情况下看到完整的内容?

javascript - 使用 Javascript 测量点击次数?

javascript - 在javascript中将文本转换为Unicode

javascript - jQuery 中 scrollTop/transform CSS 效果的正确语法?

jquery - 如何使用jquery基于xy坐标而不是使用鼠标拖动来选择元素?