如何使弹出窗口始终位于顶部? [英] how to make popup windows always on top?

查看:146
本文介绍了如何使弹出窗口始终位于顶部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有一个始终位于父页面前面的javascript/jQuery弹出窗口(子页面),类似于facebook当前的图片浏览功能.

用户单击关闭按钮将其关闭.

我尝试过如下操作:

mywindow  = window.open ("DownloadForm.aspx", "mywindow","location=1,status=1,scrollbars=1, width=350,height=150");
mywindow.moveTo(350, 350);

此代码成功地在父页面的前面打开了一个子页面,但是父页面上有jQuery代码($(#test).click()),这导致父页面始终位于页面的最前面.

我尝试将window.open()代码放在$(#test).click()之后,但是并不能解决问题.

$(#test).click()是必需的,因此我需要一种解决方法.

感谢您的帮助,谢谢.

解决方案

myWindow.focus()

许多现代浏览器阻止了此操作,但这是唯一的方法.

I want to have a javascript/jQuery popup window (child page) that is always in front of the parent page, something like facebook's current picture viewing feature.

it would be closed by the user clicking on the close button.

I have tried as below:

mywindow  = window.open ("DownloadForm.aspx", "mywindow","location=1,status=1,scrollbars=1, width=350,height=150");
mywindow.moveTo(350, 350);

this code successfully opened a child page in front of the parent page, but there is jQuery code ( $(#test).click() ) on the parent page which causes the parent page to always be in front.

I tried putting the window.open() code after $(#test).click(), but it didn't solve the problem.

The $(#test).click() is necessary, therefore I need to have a workaround.

I appreciate any help, thank you in advance.

解决方案

myWindow.focus()

Many modern browsers prevent this from working, but it's the only way.

这篇关于如何使弹出窗口始终位于顶部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆