jquery 模态对话框不适用于模态 :true

标签 jquery

不确定我在这里做错了什么。只是试图使其成为模式对话框(使页面内容变暗)。我认为它就像 modal:true 一样简单。当我单击图像时会出现一个对话框,但它不会使页面内容变暗。

<img src="images/help-35-30.png" alt="Help" class="helpdetails" style="padding-left:30px;"/>
<div class="dialogplease"><p>A comment</p></div>

<link rel="stylesheet" type="text/css" href="mycss/css/jquery-ui-1.8.20.custom.css" />
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.20/jquery-ui.js"></script>       
<script>
$(function() {

$('.dialogplease').dialog(); //init dialog
$('.dialogplease').dialog('close'); //don't show dialog yet
$('.helpdetails').click(function(e) {
    $('.dialogplease').dialog('open')({
    modal: true
    });
});
});
</script>

最佳答案

语法错误。

您应该首先进行设置:

$(function() {    
    $('.dialogplease').dialog({modal:true,autoOpen:false}); //init dialog
    $('.helpdetails').click(function(e) {
        $('.dialogplease').dialog('open');
    });
});

关于jquery 模态对话框不适用于模态 :true,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10757265/

相关文章:

javascript - 显示图标的日期选择器单击并用所选日期填充文本框

javascript - 打开/关闭表单字段的自动完成功能

php - Laravel,为选择下拉列表中的选项添加不同的html属性

javascript - 了解 jQueryUI 事件

javascript - JQuery 表情符号选择器

javascript - 在迭代 jquery 对象时添加 html

javascript - 如何使用 css 显示 :none 切换动画

javascript - 检索第 1 页到第 2 页的 Javascript 值

javascript - 循环一个数组来替换 DIV 类

javascript - 如何在jquery colorbox中自定义#cboxLoadedContent的宽度