aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/web/api/window/orientationchange_event/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-tw/web/api/window/orientationchange_event/index.html')
-rw-r--r--files/zh-tw/web/api/window/orientationchange_event/index.html69
1 files changed, 69 insertions, 0 deletions
diff --git a/files/zh-tw/web/api/window/orientationchange_event/index.html b/files/zh-tw/web/api/window/orientationchange_event/index.html
new file mode 100644
index 0000000000..fe5264163c
--- /dev/null
+++ b/files/zh-tw/web/api/window/orientationchange_event/index.html
@@ -0,0 +1,69 @@
+---
+title: 'Window: orientationchange event'
+slug: Web/API/Window/orientationchange_event
+tags:
+ - Sensors
+translation_of: Web/API/Window/orientationchange_event
+---
+<div>{{APIRef}}</div>
+
+<p><code>orientationchange</code> 事件在設備方向改變時被觸發。</p>
+
+<table class="properties">
+ <tbody>
+ <tr>
+ <th scope="row">冒泡</th>
+ <td>No</td>
+ </tr>
+ <tr>
+ <th scope="row">可取消</th>
+ <td>No</td>
+ </tr>
+ <tr>
+ <th scope="row">介面</th>
+ <td>{{domxref("Event")}}</td>
+ </tr>
+ <tr>
+ <th scope="row">事件處理器</th>
+ <td><code><a href="/zh-TW/docs/Web/API/Window/onorientationchange">onorientationchange</a></code></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="範例">範例</h2>
+
+<p>可於 <code><a href="/zh-TW/docs/Web/API/EventTarget/addEventListener">addEventListener</a></code> 方法中使用 <code>abort</code> 事件:</p>
+
+<pre class="brush:js;">window.addEventListener("orientationchange", function() {
+ console.log("the orientation of the device is now " + screen.orientation.angle);
+});
+</pre>
+
+<p>或使用 <code><a href="/zh-TW/docs/Web/API/Window/onorientationchange">onorientationchange</a></code> 事件處理器屬性:</p>
+
+<pre class="brush: js">window.onorientationchange = function() {
+ console.log("the orientation of the device is now " + screen.orientation.angle);
+};</pre>
+
+<h2 id="規範">規範</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Compat', '#event-orientationchange', 'orientationchange')}}</td>
+ <td>{{Spec2('Compat')}}</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.Window.orientationchange_event")}}</p>