aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/web/api/screen
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:43:23 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:43:23 -0500
commit218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (patch)
treea9ef8ac1e1b8fe4207b6d64d3841bfb8990b6fd0 /files/zh-tw/web/api/screen
parent074785cea106179cb3305637055ab0a009ca74f2 (diff)
downloadtranslated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.gz
translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.tar.bz2
translated-content-218934fa2ed1c702a6d3923d2aa2cc6b43c48684.zip
initial commit
Diffstat (limited to 'files/zh-tw/web/api/screen')
-rw-r--r--files/zh-tw/web/api/screen/index.html89
-rw-r--r--files/zh-tw/web/api/screen/orientation/index.html114
2 files changed, 203 insertions, 0 deletions
diff --git a/files/zh-tw/web/api/screen/index.html b/files/zh-tw/web/api/screen/index.html
new file mode 100644
index 0000000000..089203003f
--- /dev/null
+++ b/files/zh-tw/web/api/screen/index.html
@@ -0,0 +1,89 @@
+---
+title: Screen
+slug: Web/API/Screen
+translation_of: Web/API/Screen
+---
+<div>{{APIRef("CSSOM View")}}</div>
+
+<p><code>Screen</code> 介面表示了一個用戶端螢幕,通常是指呈現目前頁面的視窗。</p>
+
+<p>一般來說為顯示目前網頁的視窗,可以透過 <code>window.screen</code> 取得物件實體。</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>Returns the first available pixel available from the left side of the screen.</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>Returns the amount of horizontal space in pixels available to the window.</dd>
+ <dt>{{domxref("Screen.colorDepth")}}</dt>
+ <dd>Returns the color depth of the screen.</dd>
+ <dt>{{domxref("Screen.height")}}</dt>
+ <dd>Returns the height of the screen in pixels.</dd>
+ <dt>{{domxref("Screen.left")}}</dt>
+ <dd>Returns the distance in pixels from the left side of the main screen to the left side of the current screen.</dd>
+ <dt>{{domxref("Screen.orientation")}}</dt>
+ <dd>Returns the current orientation of the screen.</dd>
+ <dt>{{domxref("Screen.pixelDepth")}}</dt>
+ <dd>Gets the bit depth of the screen.</dd>
+ <dt>{{domxref("Screen.top")}}</dt>
+ <dd>Returns the distance in pixels from the top side of the current screen.</dd>
+ <dt>{{domxref("Screen.width")}}</dt>
+ <dd>Returns the width of the screen.</dd>
+ <dt>{{domxref("Screen.mozEnabled")}} {{gecko_minversion_inline("12.0")}}</dt>
+ <dd>Boolean. Setting to false will turn off the device's screen.</dd>
+ <dt>{{domxref("Screen.mozBrightness")}} {{gecko_minversion_inline("12.0")}}</dt>
+ <dd>Controls the brightness of a device's screen. A double between 0 and 1.0 is expected.</dd>
+</dl>
+
+<h3 id="事件處理器">事件處理器</h3>
+
+<dl>
+ <dt>{{domxref("Screen.onorientationchange")}}</dt>
+ <dd>A handler for the {{event("orientationchange")}} events.</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{domxref("Screen.lockOrientation")}}</dt>
+ <dd>Lock the screen orientation (only works in fullscreen or for installed apps)</dd>
+ <dt>{{domxref("Screen.unlockOrientation")}}</dt>
+ <dd>Unlock the screen orientation (only works in fullscreen or for installed apps)</dd>
+</dl>
+
+<p>Methods inherit from {{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>
diff --git a/files/zh-tw/web/api/screen/orientation/index.html b/files/zh-tw/web/api/screen/orientation/index.html
new file mode 100644
index 0000000000..eafa89a703
--- /dev/null
+++ b/files/zh-tw/web/api/screen/orientation/index.html
@@ -0,0 +1,114 @@
+---
+title: Screen.orientation
+slug: Web/API/Screen/orientation
+translation_of: Web/API/Screen/orientation
+---
+<div>{{APIRef("CSSOM View")}}{{SeeCompatTable}}</div>
+
+<p><code>Screen.orientation</code> 屬性可以取得螢幕目前的方向。</p>
+
+<h2 id="語法">語法</h2>
+
+<pre class="syntaxbox">var orientation = window.screen.orientation.type;
+</pre>
+
+<h2 id="回傳值">回傳值</h2>
+
+<p>回傳值為一個代表螢幕方向的字串,可能是 <code>portrait-primary</code>、<code>portrait-secondary</code>、<code>landscape-primary</code> 或 <code>landscape-secondary</code>(請參考 {{domxref("window.screen.lockOrientation","lockOrientation")}} 以瞭解更多資訊)。</p>
+
+<h2 id="範例">範例</h2>
+
+<pre class="brush: js">var orientation = screen.orientation || screen.mozOrientation || screen.msOrientation;
+
+if (orientation.type === "landscape-primary") {
+ console.log("That looks good.");
+} else if (orientation.type === "landscape-secondary") {
+ console.log("Mmmh... the screen is upside down!");
+} else if (orientation.type === "portrait-secondary" || orientation.type === "portrait-primary") {
+ console.log("Mmmh... you should rotate your device to landscape");
+}
+</pre>
+
+<h2 id="規範">規範</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('Screen Orientation', '', 'Screen Orientation')}}</td>
+ <td>{{Spec2('Screen Orientation')}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>38</td>
+ <td>{{CompatVersionUnknown}} {{property_prefix("moz")}}<sup>[1]</sup></td>
+ <td>11{{property_prefix("ms")}}<sup>[2]</sup></td>
+ <td>25</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>39</td>
+ <td>{{CompatVersionUnknown}} {{property_prefix("moz")}}<sup>[1]</sup></td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] This API is only implemented as a prefixed method (<code>mozOrientation</code>) in B2G and Firefox for Android.</p>
+
+<p>[2] This API is implemented using a prefix (<code>msOrientation</code>) in Internet Explorer for Windows 8.1 and Windows RT 8.1. It is not supported on Windows 7.</p>
+
+<h2 id="參見">參見</h2>
+
+<ul>
+ <li>{{domxref("Screen.orientation")}}</li>
+ <li>{{domxref("Screen.unlockOrientation()")}}</li>
+ <li>{{domxref("Screen.onorientationchange")}}</li>
+ <li><a href="/zh-TW/docs/Web/API/CSS_Object_Model/Managing_screen_orientation">控制畫面方向</a></li>
+</ul>