1

不知道我在这里做错了什么。只是试图使它成为一个模态对话框(使页面内容变暗)。我以为它很简单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>
4

1 回答 1

6

语法错误。

您应该最初设置它:

$(function() {    
    $('.dialogplease').dialog({modal:true,autoOpen:false}); //init dialog
    $('.helpdetails').click(function(e) {
        $('.dialogplease').dialog('open');
    });
});
于 2012-05-25T15:36:32.437 回答