diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
| commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
| tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/screen/orientation | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/ja/web/api/screen/orientation')
| -rw-r--r-- | files/ja/web/api/screen/orientation/index.html | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/files/ja/web/api/screen/orientation/index.html b/files/ja/web/api/screen/orientation/index.html new file mode 100644 index 0000000000..3bcf1c25b5 --- /dev/null +++ b/files/ja/web/api/screen/orientation/index.html @@ -0,0 +1,73 @@ +--- +title: Screen.orientation +slug: Web/API/Screen/orientation +tags: + - API + - CSSOM View + - Experimental + - Orientation + - Property + - Read-only + - Screen Orientation + - screen +translation_of: Web/API/Screen/orientation +--- +<div>{{APIRef("Screen Orientation API")}}{{SeeCompatTable}}</div> + +<p><strong><code>orientation</code></strong> は {{DOMxRef("Screen")}} インターフェイスの読み取り専用プロパティで、現在の画面の向きを返します。</p> + +<h2 id="構文">構文</h2> + +<pre class="syntaxbox">var <var>orientation</var> = window.screen.orientation;</pre> + +<h3 id="Return_value" name="Return_value">返値</h3> + +<p>画面の向きを表す {{DOMxRef("ScreenOrientation")}} のインスタンスです。</p> + +<p>なお、古い接頭辞付きのものは {{DOMxRef("DOMString")}} で {{DOMxRef("ScreenOrientation.type")}} と同等のものを返していました。</p> + +<h2 id="Example" name="Example">例</h2> + +<pre class="brush: js">var orientation = screen.msOrientation || screen.mozOrientation || (screen.orientation || {}).type; + +if (orientation === "landscape-primary") { + console.log("良い感じですね。"); +} else if (orientation === "landscape-secondary") { + console.log("うーん…。画面が上下逆です!"); +} else if (orientation === "portrait-secondary" || orientation === "portrait-primary") { + console.log("うーん…。スクリーンを横向きにした方がいいですよ"); +} else if (orientation === undefined) { + console.log("このブラウザーは orientation API に対応していません :("); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様書</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('Screen Orientation', '#dom-screen-orientation', 'orientation')}}</td> + <td>{{Spec2('Screen Orientation')}}</td> + <td>初回定義</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの対応</h2> + +<p>{{Compat("api.Screen.orientation")}}</p> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{DOMxRef("ScreenOrientation")}}</li> + <li>{{DOMxRef("Screen.onorientationchange")}}</li> + <li><a href="/ja/docs/Managing_screen_orientation">画面の向きの制御</a></li> +</ul> |
