在jQuery的切换窗口最小化 [英] Jquery toggle on window minimize

查看:1045
本文介绍了在jQuery的切换窗口最小化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当你点击另一个div的切换进出显示一个div。我怎么能修改我的code,这样当用户最小化,它会自动切换整个浏览器窗口,从视图中隐藏的分区,所以当用户未最小化窗口的div不再可见。

I have a div that toggles in and out of display when you click on another div. How could I modify my code so that when the user minimizes the whole browser window it automatically toggles, hiding the div from view so when the user un-minimizes window the div is no longer visible.

推荐答案

最小化窗口(或切换到另一个应用程序)启动时机的的 window.onblur 事件。激活窗口应该解雇 window.onfocus

Minimizing the window (or switching to another application) should fire the window.onblur event. Activating the window should fire window.onfocus

实施细节浏览器之间略有不同,但似乎有默认的JavaScript没有更好的方法(可能是你可以使用一些闪光的对象,如果闪光灯可以检测减少/最大化窗口的火必要的事件,但我不熟悉Flash)

Implementation details may differ slightly between browsers but there seems to be no better way in default javascript (may be you can use some flash object if flash can detect minimizing/maximizing of the window to fire necessary events, but I'm not familiar with flash)

这篇关于在jQuery的切换窗口最小化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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