Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 使用动态内容维护对话中心_Jquery_Jquery Ui_Jquery Ui Dialog - Fatal编程技术网

Jquery 使用动态内容维护对话中心

Jquery 使用动态内容维护对话中心,jquery,jquery-ui,jquery-ui-dialog,Jquery,Jquery Ui,Jquery Ui Dialog,我将与以下人员进行对话 $("#statusbox").dialog({ autoOpen: false, bgiframe: true, modal: true, width: 'auto', height:'auto', title:"Check Order Status", buttons: { Find: function() { get_status(); },

我将与以下人员进行对话

$("#statusbox").dialog({
    autoOpen: false,
    bgiframe: true,
    modal: true,
    width: 'auto',
    height:'auto',
    title:"Check Order Status",
    buttons: {
        Find: function() {
            get_status();
        },
        Close: function() {
            $(this).dialog('close');
        }
    }
});
当用户点击find按钮时,它运行Ajax并将订单返回到对话框,它会动态地重新调整大小,但它只会向下扩展该框。有没有办法使对话框上下延伸,使对话框保持居中

另外,如果有足够的内容,那么它可能会超出页面的边界,因此我认为我可以使用最大高度来防止出现这种情况,但是如果他们调整窗口的大小,我该怎么办


我尝试添加Max Health: 500,这并没有阻止它从底部扩展。

< P>你有代码把对话框放在屏幕中间吗?在用新信息重新填充后运行


编写一些新代码,确保长方体不高于窗口。如果是,则将对话框的高度设置为窗口的高度(如果需要填充,则设置为更小),并将
溢出设置为
滚动
。无论何时调整窗口大小,都要运行此代码。

好的,我已经让它工作了,虽然不是100%,但是非常接近

我将位置设置为“顶部”,因为
auto
总是向下展开。然后,我按照建议添加了一个open函数作为解决方法,以获得
autoHeight
以尊重
maxHeight

也就是说,我真的想用身高,而不是文件,我不知道为什么我必须从中减去200

$("#statusbox").dialog({
    autoOpen: false,
    bgiframe: true,
    modal: true,
    width: 'auto',
    height:'auto',
    position: 'top',
    title:"Check Order Status",
    open: function(event, ui) {
        $(this).css({'max-height': $(document).height()-200, 'overflow-y': 'auto'});
    },
    buttons: {
        Find: function() {
            get_status();
        },
        Close: function() {
            $(this).dialog('close');
        }
    }
});

默认情况下,它显示在屏幕中间,而且我自己也不调整对话框的大小,它自动地将宽度和高度设置为自动。