aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/screen/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/screen/index.html')
-rw-r--r--files/zh-cn/web/api/screen/index.html102
1 files changed, 102 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/screen/index.html b/files/zh-cn/web/api/screen/index.html
new file mode 100644
index 0000000000..4ca30e88e0
--- /dev/null
+++ b/files/zh-cn/web/api/screen/index.html
@@ -0,0 +1,102 @@
+---
+title: Screen
+slug: Web/API/Screen
+tags:
+ - API
+ - 参考
+ - 接口
+translation_of: Web/API/Screen
+---
+<div>{{APIRef("CSSOM View")}}</div>
+
+<p><code>Screen</code> 接口表示一个屏幕窗口,往往指的是当前正在被渲染的window对象,可以使用 <code>window.screen</code> 获取它。</p>
+
+<p>请注意:由浏览器决定提供屏幕对象,此对象一般通过当前浏览器窗口活动状态动态检测来得到。</p>
+
+<h2 id="Example" name="Example">属性</h2>
+
+<dl>
+ <dt>{{domxref("Screen.availTop")}}</dt>
+ <dd>Specifies the y-coordinate of the first pixel that is not allocated to permanent or semipermanent user interface features.</dd>
+ <dt>{{domxref("Screen.availLeft")}}</dt>
+ <dd>返回屏幕左边边界的第一个像素点</dd>
+ <dt>{{domxref("Screen.availHeight")}}</dt>
+ <dd>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.</dd>
+ <dt>{{domxref("Screen.availWidth")}}</dt>
+ <dd>返回窗口中水平方向可用空间的像素值。</dd>
+ <dt>{{domxref("Screen.colorDepth")}}</dt>
+ <dd>返回屏幕的色彩深度。</dd>
+ <dt>{{domxref("Screen.height")}}</dt>
+ <dd>以像素为单位返回屏幕的高度。</dd>
+ <dt>{{domxref("Screen.left")}}</dt>
+ <dd>返回从最左边界到当前屏幕的像素值。</dd>
+ <dt>{{domxref("Screen.orientation")}}</dt>
+ <dd>返回当前屏幕的转向。</dd>
+ <dt>{{domxref("Screen.pixelDepth")}}</dt>
+ <dd>获取屏幕的像素点</dd>
+ <dt>{{domxref("Screen.top")}}</dt>
+ <dd>返回最上边界到当前屏幕的像素值。</dd>
+ <dt>{{domxref("Screen.width")}}</dt>
+ <dd>返回屏幕的宽度。</dd>
+ <dt>{{domxref("Screen.mozEnabled")}} {{gecko_minversion_inline("12.0")}}</dt>
+ <dd>布尔值。如果设置为false讲关闭设备的屏幕。</dd>
+ <dt>{{domxref("Screen.mozBrightness")}} {{gecko_minversion_inline("12.0")}}</dt>
+ <dd>控制设备屏幕的亮度。期望参数是0-1.0之间的浮点数。</dd>
+</dl>
+
+<h3 id="Events_handler">Events handler</h3>
+
+<dl>
+ <dt>{{domxref("Screen.onorientationchange")}}</dt>
+ <dd>对{{event("orientationchange")}} 事件的时间处理器。</dd>
+ <dt> </dt>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{domxref("Screen.lockOrientation")}}</dt>
+ <dd>锁定屏幕转向(仅在全屏或者已安装的APP中生效)</dd>
+ <dt>{{domxref("Screen.unlockOrientation")}}</dt>
+ <dd>解锁屏幕转向(仅在全屏或者已安装的APP中生效)</dd>
+</dl>
+
+<p>方法继承于 {{domxref("EventTarget")}}</p>
+
+<p>{{page("/en-US/docs/Web/API/EventTarget","Methods")}}</p>
+
+<h2 id="Example" name="Example">示例</h2>
+
+<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">标准文档说明</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{ SpecName('CSSOM View', '#the-screen-interface', 'Screen') }}</td>
+ <td>{{ Spec2('CSSOM View') }}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div class="hidden">
+<p>The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+</div>
+
+<p>{{Compat("api.Screen")}} </p>