Screen

Screen 介面表示了一個用戶端螢幕,通常是指呈現目前頁面的視窗。

一般來說為顯示目前網頁的視窗,可以透過 window.screen 取得物件實體。

屬性

Screen.availTop (en-US)

Specifies the y-coordinate of the first pixel that is not allocated to permanent or semipermanent user interface features.

Screen.availLeft (en-US)

Returns the first available pixel available from the left side of the screen.

Screen.availHeight (en-US)

Specifies the height of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the Taskbar on Windows.

Screen.availWidth (en-US)

Returns the amount of horizontal space in pixels available to the window.

Screen.colorDepth (en-US)

Returns the color depth of the screen.

Screen.height (en-US)

Returns the height of the screen in pixels.

Screen.left (en-US)

Returns the distance in pixels from the left side of the main screen to the left side of the current screen.

Screen.orientation

Returns the current orientation of the screen.

Screen.pixelDepth (en-US)

Gets the bit depth of the screen.

Screen.top (en-US)

Returns the distance in pixels from the top side of the current screen.

Screen.width (en-US)

Returns the width of the screen.

Screen.mozEnabled (en-US)

Boolean. Setting to false will turn off the device's screen.

Screen.mozBrightness (en-US)

Controls the brightness of a device's screen. A double between 0 and 1.0 is expected.

事件處理器

方法

Also inherits methods from its parent EventTarget.

Screen.lockOrientation (en-US) 已棄用

Lock the screen orientation (only works in fullscreen or for installed apps)

Screen.unlockOrientation (en-US) 已棄用

Unlock the screen orientation (only works in fullscreen or for installed apps)

範例

if (screen.pixelDepth < 8) {
  // use low-color version of page
} else {
  // use regular, colorful page
}

規範

Specification
CSSOM View Module
# the-screen-interface