不确定我在这里做错了什么。只是想让它成为一个模态对话框(使页面内容变暗)。我认为它就像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>
答案 0 :(得分:6)
语法错误。
您最初应该设置:
$(function() {
$('.dialogplease').dialog({modal:true,autoOpen:false}); //init dialog
$('.helpdetails').click(function(e) {
$('.dialogplease').dialog('open');
});
});