繁体   English   中英

是否可以使用jquery对话框设置位置和自动宽度?

[英]Is it possible to set position and auto width with jquery dialog box?

我想知道是否可以设置对话框的位置,例如从左侧60px开始,然后从该60px向屏幕右侧设置100%。

这是一张图片,可以更清楚地说明我要执行的操作。

    <button id="opener">Open Dialog</button>
<div id="dialog" title="Basic dialog">
    <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
    <p>
        <button id="opener2">Open a nested dialog</button>
    </p>
</div>
<div id="dialog2" title="Nested dialog">
    <p>I would like this particular box to be positioned from the left, while the rest of the box extends to the right side of the window.</p>
</div>

    $("#opener").click(function () {
    $("#dialog").dialog("open");
});
$("#dialog").dialog({
    autoOpen: false,
    modal: false,
    position: [0,63],
    width: 283,
    open: function (event, ui) {
        $(".ui-dialog #opener2").click(function () {
            $("#dialog2").dialog("open");
        });
    }
});
    var w = $(window).width();

$("#dialog2").dialog({
    autoOpen: false,
    modal: false,
    position: [294,63],

});

    .ui-widget-overlay {
    background: rgba(0,0,0,0.9);
}

首先让我知道您的源代码。 如果您使用引导程序,请执行以下操作。

<div class="col-md-4">
Your basic dialog..
</div>

<div class="col-md-8">
Your nested dialog box..
</div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM