简体   繁体   English

弹出窗口始终位于顶部

[英]Popup window always on top

Am looking at whatever hacks that are possible to keep a window always on top (apart from window.focus()). 我正在寻找可以使窗口始终位于顶部的各种hack(除了window.focus()之外)。 Maybe a hidden textbox to which I can set focus etc. 也许是我可以将焦点设置到的隐藏文本框等。

I see this happening in LivePerson (support) whenever a new message arrives. 每当有新消息到达时,我都会在LivePerson(支持)中看到这种情况。 I have legitimate use of this and not to annoy users with ads or anything. 我对此有合理的使用,不要以广告或其他任何方式使用户烦恼。

Any hacks for any browsers will do. 任何浏览器的黑客都可以。 I am not looking at a complete cross-browser solution. 我不是在寻找完整的跨浏览器解决方案。 I think window.focus would work for Internet Explorer, though I am yet to test it. 我认为window.focus可以用于Internet Explorer,尽管我尚未对其进行测试。

此JavaScript代码会将弹出窗口置于所有其他打开的浏览器窗口的顶部,直到查看器关闭包含以下JavaScript代码的窗口为止:

<body onblur="self.focus();"> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM