跳转到:

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译
您也可以阅读此文章的English (US)版。

The windowState read-only property of the Window interface returns the window's current state.

More info on window events and Window.state can be seen here.

Syntax

var state = window.windowState;

Return value

Possible windowState values are:

State Value Description
STATE_MAXIMIZED 1 The window is maximized.
STATE_MINIMIZED 2 The window is minimized.
STATE_NORMAL 3 The window is normal.
STATE_FULLSCREEN 4 The window is in full screen mode.

Example

if (window.windowState === 1) {} // window is maximized
else if (window.windowState === 2) {} // window is minimized
else if (window.windowState === 3) {} // window is normal
else if (window.windowState === 4) {} // window is in fullscreen mode
else {}

文档标签和贡献者

此页面的贡献者: mfluehr, fscholz, kscarfone, jswisher, NatureShade
最后编辑者: mfluehr,