gpt4 book ai didi

jquery - 简单的 jQuery 对话框锁定 Chrome、IE

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

以下 HTML 显示一个按钮,单击时会调用一个 jQuery 对话框。

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
</head>
<body>
<div id="dialog">
</div>
<button>
Open</button>
<script type="text/javascript">
$(document).ready(function () {
$('#dialog').dialog({
autoOpen: false,
modal: true
});

$('button').click(function () {
$('#dialog').dialog('open');
});
});

</script>
</body>
</html>

在 Chrome 中,当对话框显示时,滚动条会显示为超出窗口边界。此外,当您移动滚动条时,它们会被锁定。在IE9中,浏览器崩溃。这段代码看起来很简单。

我还创建了一个 jsFiddle 示例... http://jsfiddle.net/jeljeljel/RcR8e/

谁能告诉我这是怎么回事吗?

最佳答案

您缺少 jquery ui css 文件。

更新的 fiddle :http://jsfiddle.net/jensbits/RcR8e/7/

jquery ui site under themes 上有多种可供选择。 fiddle 使用http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/start/jquery-ui.css

关于jquery - 简单的 jQuery 对话框锁定 Chrome、IE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7835860/

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