Window.windowState
Check for window state:
State | value | Descrption |
---|---|---|
STATE_MAXIMIZED |
1 | The window is maximized. |
STATE_ |
2 | The window is minimized. |
STATE_ |
3 | The window is normal. |
STATE_ |
4 | The window is in full screen mode. |
Sample:
JavaScript
Copy Code
<code class="brush: js">if (window.windowState === 1) {} // check if window is maximized <code class="brush: js">else if (window.windowState === 2) {} // check if window is minimized <code class="brush: js">else if (window.windowState === 3) {} // check if window is normal <code class="brush: js">else if (window.windowState === 4) {} // check if window is in fullscreen mode else {}</code></code></code> </code>
Note:
More info on window events and window.state can be seen here.
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/window/windowstate