aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/window/screen/index.html
blob: 699d85d5c7c720b938e2ebba3268efda1f58b21a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
---
title: Window.screen
slug: Web/API/Window/screen
tags:
  - screen
translation_of: Web/API/Window/screen
---
<div>{{APIRef("CSSOM View")}}</div>

<p>返回当前window的screen对象。screen对象实现了{{domxref("Screen")}}接口,它是个特殊的对象,返回当前渲染窗口中和屏幕有关的属性。</p>

<h2 id="Syntax" name="Syntax">语法</h2>

<pre class="syntaxbox"><var>screenObj</var> = <var>window</var>.screen;
</pre>

<p> </p>

<h2 id="Example" name="Example">示例</h2>

<p> </p>

<pre class="brush:js">if (screen.pixelDepth &lt; 8) {
  // use low-color version of page
} else {
  // use regular, colorful page
}
</pre>

<h2 id="Specification" name="Specification">Specification</h2>

<p>TBD</p>