gpt4 book ai didi

jquery - 居中 jQuery 模态对话框弹出窗口

转载 作者:行者123 更新时间:2023-11-28 12:15:18 26 4
gpt4 key购买 nike

我试图在用户访问我的主页时显示模式对话框/弹出窗口。

我可以显示对话框,但它没有出现在屏幕中央。

我正在导入这些文件,以防出现问题:

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

<script language="JavaScript" type="text/javascript">
$(function () {
$("#dialog-modal").dialog({
width: 'auto',
// position: 'center',
center: true,
modal: true,
autoOption: true,
resizable: false
});
});
</script>

<div id="dialog-modal" title="Offer" style="text-align:center"><img alt="" src="Pack.jpg"/> </div>

我的 fiddle :http://jsfiddle.net/szEpb/

谢谢

最佳答案

尝试取消注释 //position: 'center',

或者如果它不起作用,请尝试下面的代码。希望这就是你的意思......:)

$('body').dialog('option', 'position', 'center');

如果您需要在特定选择器处居中,请尝试

$('your_selector').dialog('option', 'position', 'center');

关于jquery - 居中 jQuery 模态对话框弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19219538/

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