开发者

jquery dialog: drag dialog at any point

Is there a trick to make a jquery dialog be draggable at any point? (i mean not only in the title开发者_运维知识库 bar)


As opposed to a sortable item, dialog items doesn't have that functionality (I'm not sure why). If needed, you might be able to do something like this:

$(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: ''});
});

See a working example here: http://jsfiddle.net/gMP2d/


$("#div_id")
    .dialog({
        position: [3,442],
        width: 300,
        height: 90
    })
    .css({cursor: 'move'})
    .parent()
    .draggable({cancel:'',handle:''});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜