javascript 如何在 JQueryUI - Modal Form 中禁用背景?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7666931/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 00:51:47  来源:igfitidea点击:

How to disable background in JQueryUI - Modal Form?

javascriptasp.net-mvcjquery-ui

提问by StartingFromScratch

I have just started working in jQuery and ASP.NET MVC. I want the same modal form mentioned in the example of JQuery site - http://jqueryui.com/demos/dialog/#modal-form

我刚刚开始使用 jQuery 和 ASP.NET MVC。我想要在 JQuery 站点示例中提到的相同模态表单 - http://jqueryui.com/demos/dialog/#modal-form

$("#divSchedule").dialog({ 
                          autoOpen: false,
                          show: "slide", 
                          modal: true   
                         });
$("#btn").click(function () {
    $("#divSchedule").dialog("open"); 
    return false;
});

Dialog appears on the page but user can click on any of the background controls. Can you please suggest something to disable(blur) the background? Is it something to do with CSS?

对话框出现在页面上,但用户可以单击任何背景控件。你能提出一些禁用(模糊)背景的建议吗?和 CSS 有关系吗?

回答by eagerMoose

Basically you made a mess of your dialog definition, try this http://jsfiddle.net/tctc2/1/

基本上你把你的对话框定义弄得一团糟,试试这个http://jsfiddle.net/tctc2/1/

回答by Zack S

The quick answer for his question is: use modal: truein order to

他的问题的快速答案是:使用modal: true为了

  1. make background darker
  2. disable any interaction with background functionality
  1. 使背景更暗
  2. 禁用与后台功能的任何交互