jQuery模态对话框不适用于modal:true [英] jquery modal dialog doesn't work with modal:true

查看:252
本文介绍了jQuery模态对话框不适用于modal:true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知道我在做什么错.只是尝试使其成为模式对话框(缩小页面内容).我以为它就像modal:true一样简单.单击图像时会出现一个对话框,但它不会使页面内容变暗.

Not sure what I'm doing wrong here. Just trying to make it a modal dialog (dim out the page content). I thought it is as simple as modal:true. A dialog comes up when I click the image but it doesn't dim out the page content.

<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>

推荐答案

语法错误.

您应该首先进行以​​下设置:

You should set this initially:

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

这篇关于jQuery模态对话框不适用于modal:true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆