aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/deviceorientationevent
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/deviceorientationevent
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/deviceorientationevent')
-rw-r--r--files/zh-cn/web/api/deviceorientationevent/absolute/index.html100
-rw-r--r--files/zh-cn/web/api/deviceorientationevent/alpha/index.html53
-rw-r--r--files/zh-cn/web/api/deviceorientationevent/beta/index.html97
-rw-r--r--files/zh-cn/web/api/deviceorientationevent/gamma/index.html98
-rw-r--r--files/zh-cn/web/api/deviceorientationevent/index.html119
5 files changed, 467 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/deviceorientationevent/absolute/index.html b/files/zh-cn/web/api/deviceorientationevent/absolute/index.html
new file mode 100644
index 0000000000..2ac880891c
--- /dev/null
+++ b/files/zh-cn/web/api/deviceorientationevent/absolute/index.html
@@ -0,0 +1,100 @@
+---
+title: DeviceOrientationEvent.absolute
+slug: Web/API/DeviceOrientationEvent/absolute
+translation_of: Web/API/DeviceOrientationEvent/absolute
+---
+<p>{{ apiref("Device Orientation Events") }}</p>
+
+<p>表示该设备是否提供绝对定位数据 (这个数据是关于地球的坐标系) 或者使用了由设备决定的专门的坐标系. 查看更多关于 <a href="/en/DOM/Orientation_and_motion_data_explained" title="Orientation and motion data explained">Orientation and motion data explained</a> 的细节.</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">var absolute = <em>instanceOfDeviceOrientationEvent</em>.absolute;
+</pre>
+
+<p>如果方向数据跟地球坐标系和设备坐标系有差异,则<code>absolute</code>为<code>true</code>,如果方向数据由设备本身的坐标系提供,则<code>absolute</code>为<code>false</code>。</p>
+
+<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('Device Orientation')}}</td>
+ <td>{{Spec2('Device Orientation')}}</td>
+ <td>Initial specification.</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>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>7.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>6 [1]</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Edge</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>3.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>6 [1]</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>4.2</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] Firefox 3.6, 4, and 5 supported <a href="/en-US/DOM/MozOrientation">mozOrientation </a>instead of the standard <code>DeviceOrientationEvent</code> interface</p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li>{{ domxref("DeviceOrientationEvent") }}</li>
+ <li><a href="/en/Detecting_device_orientation" title="Detecting device orientation">Detecting device orientation</a></li>
+ <li><a href="/en/DOM/Orientation_and_motion_data_explained" title="Orientation and motion data explained">Orientation and motion data explained</a></li>
+ <li>{{ domxref("window.ondeviceorientation") }}</li>
+ <li>{{ event("deviceorientation") }}</li>
+</ul>
diff --git a/files/zh-cn/web/api/deviceorientationevent/alpha/index.html b/files/zh-cn/web/api/deviceorientationevent/alpha/index.html
new file mode 100644
index 0000000000..e4a6a0a4d4
--- /dev/null
+++ b/files/zh-cn/web/api/deviceorientationevent/alpha/index.html
@@ -0,0 +1,53 @@
+---
+title: DeviceOrientationEvent.alpha
+slug: Web/API/DeviceOrientationEvent/alpha
+tags:
+ - API
+ - 陀螺仪
+translation_of: Web/API/DeviceOrientationEvent/alpha
+---
+<p>{{ ApiRef("Device Orientation Events") }}</p>
+
+<p>返回设备旋转时Z轴的值;即:设备围绕屏幕中心扭转的角度。  详细信息请查看<a href="/en/DOM/Orientation_and_motion_data_explained" title="Orientation and motion data explained">方向和运动数据</a>。</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox">var alpha = <em>instanceOfDeviceOrientationEvent</em>.alpha;
+</pre>
+
+<h2 id="Specifications">Specifications</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('Device Orientation')}}</td>
+ <td>{{Spec2('Device Orientation')}}</td>
+ <td>Initial specification.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p> </p>
+
+<p>{{Compat("api.DeviceOrientationEvent.alpha")}}</p>
+
+<p> </p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{ domxref("DeviceOrientationEvent") }}</li>
+ <li><a href="/en/Detecting_device_orientation" title="Detecting device orientation">Detecting device orientation</a></li>
+ <li><a href="/en/DOM/Orientation_and_motion_data_explained" title="Orientation and motion data explained">Orientation and motion data explained</a></li>
+ <li>{{ domxref("window.ondeviceorientation") }}</li>
+ <li>{{ event("deviceorientation") }}</li>
+</ul>
diff --git a/files/zh-cn/web/api/deviceorientationevent/beta/index.html b/files/zh-cn/web/api/deviceorientationevent/beta/index.html
new file mode 100644
index 0000000000..9cec365dce
--- /dev/null
+++ b/files/zh-cn/web/api/deviceorientationevent/beta/index.html
@@ -0,0 +1,97 @@
+---
+title: DeviceOrientationEvent.beta
+slug: Web/API/DeviceOrientationEvent/beta
+translation_of: Web/API/DeviceOrientationEvent/beta
+---
+<p>{{ ApiRef("Device Orientation Events") }}</p>
+
+<p>返回设备旋转时X轴的值. 即: 角度的数值, 范围介于-180 ------ 180之间  表示设备正在向前或向后倾斜.更多信息见  <a href="/en/DOM/Orientation_and_motion_data_explained" title="Orientation and motion data explained">方向和运动数据详解</a></p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">var beta = <em>instanceOfDeviceOrientationEvent</em>.beta;</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('Device Orientation')}}</td>
+ <td>{{Spec2('Device Orientation')}}</td>
+ <td>Initial specification.</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>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>7.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>6 [1]</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Edge</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>3.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>6 [1]</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>4.2</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] Firefox 3.6, 4, and 5 supported <a href="/en-US/DOM/MozOrientation">mozOrientation </a>instead of the standard <code>DeviceOrientationEvent</code> interface</p>
+
+<h2 id="另请参阅">另请参阅</h2>
+
+<ul>
+ <li>{{ domxref("DeviceOrientationEvent") }}</li>
+ <li><a href="/en/Detecting_device_orientation" title="Detecting device orientation">Detecting device orientation</a></li>
+ <li><a href="/en/DOM/Orientation_and_motion_data_explained" title="Orientation and motion data explained">Orientation and motion data explained</a></li>
+ <li>{{ domxref("window.ondeviceorientation") }}</li>
+ <li>{{ event("deviceorientation") }}</li>
+</ul>
diff --git a/files/zh-cn/web/api/deviceorientationevent/gamma/index.html b/files/zh-cn/web/api/deviceorientationevent/gamma/index.html
new file mode 100644
index 0000000000..6bff9aef20
--- /dev/null
+++ b/files/zh-cn/web/api/deviceorientationevent/gamma/index.html
@@ -0,0 +1,98 @@
+---
+title: DeviceOrientationEvent.gamma
+slug: Web/API/DeviceOrientationEvent/gamma
+translation_of: Web/API/DeviceOrientationEvent/gamma
+---
+<p>{{ apiref("Device Orientation Events") }}</p>
+
+<p>返回设备旋转时Y轴的值;<font><font>即,多少度,介于之间</font></font><code>-90</code><font><font>和</font></font><code>90</code><font><font>,通过该装置被接通向左或向右。</font><font>见</font></font><a href="https://developer.mozilla.org/en/DOM/Orientation_and_motion_data_explained" title="取向和运动数据解释"><font><font>方向和运动数据解释</font></font></a><font><font>的细节。</font></font></p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox">var gamma = <em>orientationEvent</em>.gamma;
+</pre>
+
+<h2 id="Specifications">Specifications</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><a href="https://w3c.github.io/deviceorientation/spec-source-orientation.html" hreflang="en" lang="en" title="“设备方向事件”规范"><font><font>设备方向事件</font></font></a></td>
+ <td>{Spec2('Device Orientation')}}</td>
+ <td>Initial specification.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>7.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>6 [1]</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Edge</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>3.0</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>6 [1]</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>4.2</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p><font><font>[1]火狐3.6,图4和5支撑</font></font><a href="https://developer.mozilla.org/en-US/DOM/MozOrientation"><font><font>mozOrientation</font></font></a><font><font>而不是标准</font></font><code>DeviceOrientationEvent</code><font><font>接口</font></font></p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{ domxref("DeviceOrientationEvent") }}</li>
+ <li><a href="/en/Detecting_device_orientation" title="Detecting device orientation">Detecting device orientation</a></li>
+ <li><a href="/en/DOM/Orientation_and_motion_data_explained" title="Orientation and motion data explained">Orientation and motion data explained</a></li>
+ <li>{{ domxref("window.ondeviceorientation") }}</li>
+ <li>{{ event("deviceorientation") }}</li>
+</ul>
diff --git a/files/zh-cn/web/api/deviceorientationevent/index.html b/files/zh-cn/web/api/deviceorientationevent/index.html
new file mode 100644
index 0000000000..a65efefa94
--- /dev/null
+++ b/files/zh-cn/web/api/deviceorientationevent/index.html
@@ -0,0 +1,119 @@
+---
+title: DeviceOrientationEvent
+slug: Web/API/DeviceOrientationEvent
+translation_of: Web/API/DeviceOrientationEvent
+---
+<p>{{apiref("Device Orientation Events")}}{{SeeCompatTable}}</p>
+
+<p><code>DeviceOrientationEvent提供给网页开发者当设备(指手机,平板等移动设备)在浏览页面时物理旋转的信息。</code></p>
+
+<div class="warning">
+<p><strong>警告:</strong> 当前,火狐浏览器和谷歌浏览器并未能用同一种方式实现,在使用请注意。(见后文) </p>
+</div>
+
+<h2 id="属性">属性</h2>
+
+<dl>
+ <dt>{{domxref("DeviceOrientationEvent.absolute")}} {{readonlyinline}}</dt>
+ <dd>用来说明设备是提供的旋转数据是否是绝对定位的布尔值。</dd>
+ <dt>{{domxref("DeviceOrientationEvent.alpha")}} {{readonlyinline}}</dt>
+ <dd>一个表示设备绕z轴旋转的角度(范围在0-360之间)的数字</dd>
+ <dt> </dt>
+ <dt>{{domxref("DeviceOrientationEvent.beta")}} {{readonlyinline}}</dt>
+ <dd>一个表示设备绕x轴旋转(范围在-180到180之间)的数字,从前到后的方向为正方向。</dd>
+ <dt>{{domxref("DeviceOrientationEvent.gamma")}} {{readonlyinline}}</dt>
+ <dd>一个表示设备绕y轴旋转(范围在-90到90之间)的数字,从左向右为正方向。</dd>
+</dl>
+
+<h2 id="例子">例子</h2>
+
+<pre class="brush: js">window.addEventListener('deviceorientation', function(event) {
+  console.log(event.alpha + ' : ' + event.beta + ' : ' + event.gamma);
+});</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">草案</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('Device Orientation')}}</td>
+ <td>{{Spec2('Device Orientation')}}</td>
+ <td>Initial specification.</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 (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>7.0 [1]</td>
+ <td>6 [2]</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Android Webview</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ <th>Chrome for Android</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>3.0</td>
+ <td>{{CompatVersionUnknown}} [1]</td>
+ <td>6 [2]</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>4.2</td>
+ <td>{{CompatVersionUnknown}} [1]</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>[1] 在版本50之前Chrome为该事件提供绝对的值而非相对的值。开发者仍需使用绝对的值,当使用{{domxref("ondeviceorientationabsolute")}} 事件时.</p>
+
+<p>[2] 火狐3.6, 4, and 5支持<a href="/en-US/DOM/MozOrientation">mozOrientation </a>而非标准的 <code>DeviceOrientationEvent</code></p>
+
+<h2 id="参考">参考</h2>
+
+<ul>
+ <li>{{ event("deviceorientation") }}</li>
+ <li>{{ domxref("DeviceMotionEvent") }}</li>
+ <li>{{ event("devicemotion") }}</li>
+ <li><a href="/en-US/docs/WebAPI/Detecting_device_orientation" title="/en-US/docs/WebAPI/Detecting_device_orientation">监测设备方向</a></li>
+ <li><a href="https://developer.mozilla.org/en/DOM/Orientation_and_motion_data_explained" title="Orientation and motion data explained">转动与运动的数据说明</a></li>
+</ul>