jQuery UI对话框:如何使用`modal:false`选项添加叠加层?

时间:2021-12-20 19:42:02

Is it possible to add overlay to dialog with modal: false? Maybe with the help of external class...

是否可以使用modal:false添加叠加到对话框?也许在外部阶级的帮助下......

Really need it!

真的需要它!

Thanks!

谢谢!

1 个解决方案

#1


2  

You can try adding a div as the first element of body and displaying it when you open the dialog box. Here is sample CSS for that div. This will create a div covering the entire page with black color an opacity 70%. You will have to adjust the z-index according to the z-index of the dialog and use the open event of jquery UI dialog to make this div visible.

您可以尝试添加div作为正文的第一个元素,并在打开对话框时显示它。这是该div的示例CSS。这将创建一个覆盖整个页面的div,黑色,不透明度为70%。您必须根据对话框的z-index调整z-index,并使用jquery UI对话框的open事件使此div可见。

.overlaydiv{ background-color: #000000; display: none; height: 100%; -moz-opacity: 0.7; opacity:.70; filter: alpha(opacity=70); left: 0%; position: fixed; top: 0%; width: 100%; z-index:1001; } 

Make sure to add a div right after the opening tag, else it would not cover the entire page.

确保在开始标记之后添加div,否则它不会覆盖整个页面。

<body>
<div class="overlaydiv"></div>
...
</body>

#1


2  

You can try adding a div as the first element of body and displaying it when you open the dialog box. Here is sample CSS for that div. This will create a div covering the entire page with black color an opacity 70%. You will have to adjust the z-index according to the z-index of the dialog and use the open event of jquery UI dialog to make this div visible.

您可以尝试添加div作为正文的第一个元素,并在打开对话框时显示它。这是该div的示例CSS。这将创建一个覆盖整个页面的div,黑色,不透明度为70%。您必须根据对话框的z-index调整z-index,并使用jquery UI对话框的open事件使此div可见。

.overlaydiv{ background-color: #000000; display: none; height: 100%; -moz-opacity: 0.7; opacity:.70; filter: alpha(opacity=70); left: 0%; position: fixed; top: 0%; width: 100%; z-index:1001; } 

Make sure to add a div right after the opening tag, else it would not cover the entire page.

确保在开始标记之后添加div,否则它不会覆盖整个页面。

<body>
<div class="overlaydiv"></div>
...
</body>