ScreenOrientation
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2023年3月.
* Some parts of this feature may have varying levels of support.
Screen Orientation API の ScreenOrientation インターフェイスは、文書の現在の向きの情報を提供します。
ScreenOrientation オブジェクトのインスタンスは、screen.orientation プロパティで取得できます。
インスタンスプロパティ
ScreenOrientation.type読取専用-
文書の現在の向きのタイプを返します。
"portrait-primary"、"portrait-secondary"、"landscape-primary"、"landscape-secondary"のいずれかです。 ScreenOrientation.angle読取専用-
文書の現在の向きの角度を返します。
イベントハンドラー
ScreenOrientation.onchange-
画面の向きが変わるたびに呼ばれるイベントハンドラーです。
インスタンスメソッド
ScreenOrientation.lock()-
含んでいる文書の向きをデフォルトの向きに固定し、
Promiseを返します。 ScreenOrientation.unlock()-
含んでいる文書の向きのデフォルトの向きへの固定を解除します。
仕様書
| Specification |
|---|
| Screen Orientation> # screenorientation-interface> |
ブラウザーの互換性
Loading…