gpt4 book ai didi

jquery - 模式对话框不会在页面加载时隐藏

转载 作者:行者123 更新时间:2023-12-03 22:30:17 25 4
gpt4 key购买 nike

我正在尝试创建一个模式对话框来仅显示内容(某种html或其他):

<script>
$.fx.speeds._default = 1000;
$(function() {
$( "#dialog" ).dialog({
autoOpen: false,
closeOnEscape: true,
modal: true,
position: 'center',
width: 800,
height: 600,
show: "blind",
hide: "explode"
});

$( "#opener" ).click(function() {
$( "#dialog" ).dialog( "open" );
return false;
});

});
</script>

当我查看页面时,对话框是内联的并且没有隐藏。这是我的 html:

<div id="dialog">This is my dialog that should be hidden until called</div>
<button id="opener">I Open the Dialog</button>

我做错了什么?

最佳答案

使用 css 隐藏 div,如下所示:

<div id="dialog" style="display:none;">This is my dialog that should be hidden until called</div>

现在它只会在被调用时显示。

关于jquery - 模式对话框不会在页面加载时隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7573960/

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