如何捕获整个浏览器窗口的模糊和焦点?

编程入门 行业动态 更新时间:2024-10-26 18:21:36
本文介绍了如何捕获整个浏览器窗口的模糊和焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想捕捉实际浏览器窗口的模糊和焦点 - 意味着焦点更改为子帧不感兴趣。

I would like to capture the blur and focus of the actual browser window - meaning that change of focus to child frames is not of interest.

目前我一直在使用 $(上).focus() $(上).blur()

和 $(窗口).focus() $(窗口).blur()

然而,当用户将焦点更改为嵌入式iframe时,这些会触发,我不这样做希望。

However, these fire when the user changes focus to embedded iframes, which I don't want.

有没有人知道如何捕获TRUE激活和停用窗口?

Does anyone know of a way to capture TRUE activation and deactivation of the window?

]

当用户从网页移动到嵌入式iframe的网页时,模糊和焦点事件会触发。 这与窗口激活事件不同,事件激活事件仅在实际的浏览器窗口(或选项卡)被带到前面或被发送(即,更改或最小化)时触发。

Blur and focus events fire when a user moves from a web-page, to the web-page of an embedded iframe. This is different from 'window activation' events, which only fire when the actual BROWSER WINDOW (or tab) is brought to the front, or sent away (i.e, tab changed, or minimized).

我对模糊不感兴趣,因为用户导航到嵌入式框架的事实对程序没有影响。但是,如果用户最小化窗口,更改选项卡或切换到另一个程序,我想知道它...

I am not interested in blur, because the fact that the user has navigated to an embedded frame is of no consequence to the program. However, if the user minimizes the window, changes tabs, or switches to another program, I want to know about it...

推荐答案

我有这个

$(function() { $(window) .focus(function() { document.getElementById('play_banner').value = true; }) .blur(function() { document.getElementById('play_banner').value = false; }) })

在IE,firefox和chrome上工作正常只有当play_banner设置为true时才有效,所以当用户更改页面时它会停止工作,当他回来时它会继续从那里开始......

working fine on IE, firefox and chrome, where the banner only animate when play_banner is set to true, so it stop working when the user changes the page, and when he's back it continues from where it was...

更多推荐

如何捕获整个浏览器窗口的模糊和焦点?

本文发布于:2023-10-08 09:00:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1472136.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模糊   浏览器   窗口   焦点

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!