gpt4 book ai didi

jQuery UI 对话框动态高度和宽度

转载 作者:行者123 更新时间:2023-12-01 03:56:38 25 4
gpt4 key购买 nike

我正在使用带有 iframe 的 jQuery UI 对话框:

function showDialog(url, title, refresh){           
var horizontalPadding = 30;
var verticalPadding = 30;
var width = 650; height = 800;
$('<iframe id="modalIframeId" allowtransparency="true" style="background-color:#c0c0c0;" frameborder="0" class="ModalIFrame" src="' + url + '" />')
.dialog({
title: title,
width: width,
height: height,
modal: true,
resizable: true,
autoResize: true,
close: function(ev, ui) {
if(refresh)
location.reload();
else
$(this).close();
},
overlay: {
opacity: 0.7,
background: "black"
}
})
.width(width - horizontalPadding)
.height(height - verticalPadding);
return false;
}

是否可以像窗口大小一样设置宽度高度

谢谢

最佳答案

根据documentation你可以。

(添加代码是因为链接不会将用户直接带到正确的部分):

选项 - 宽度

使用指定的宽度选项初始化对话框:
代码示例:

调用close方法:

$( ".selector" ).dialog( "close" );

初始化后获取或设置宽度选项:

//Getter
var width = $( ".selector" ).dialog( "option", "width" );

//Setter
$( ".selector" ).dialog( "option", "width", 500 );

关于jQuery UI 对话框动态高度和宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1874325/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com