gpt4 book ai didi

javascript - 在父选项卡(页面)上显示叠加层,直到打开其所有子选项卡(页面)

转载 作者:行者123 更新时间:2023-11-28 06:50:36 24 4
gpt4 key购买 nike

假设我有父页面。

Click

当我单击“打印”时,会打开一个新选项卡(页面)以进行打印预览。

我想要的是,当我单击“打印”时,父选项卡(页面)上应显示覆盖层,以停止进一步的工作,直到子选项卡关闭。

Because when print tab (page) (child) is opened, most of the functions on parent tab (page) are not working properly.

注意:我正在使用 Google 默认打印/预览功能。

我无法编写代码来执行上述场景。如何在父页面中检测到其子页面已关闭?

最佳答案

您可以在 jQuery 中使用dialog follow this link to view或者您可以在代码中使用,例如

var childNode= window.open('/uri of child');

然后使用

childNode.onunload = function(){  
// code after child closed
}

如果没有的话你也可以尝试

window.onunload = function() {if(!window.opener.closed && childNode.closed){
//code after child closed
}}

关于javascript - 在父选项卡(页面)上显示叠加层,直到打开其所有子选项卡(页面),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32986801/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com