Window: orientationchange イベント

orientationchange イベントは、端末の向きが変化した時に発生します。

バブリング なし
キャンセル 不可
インターフェイス Event
イベントハンドラー onorientationchange

orientationchange イベントは addEventListener メソッドで使用することができます。

js
window.addEventListener("orientationchange", function () {
  console.log("端末の向きが " + screen.orientation.angle + "になりました。");
});

または、 onorientationchange イベントハンドラープロパティを使用します。

js
window.onorientationchange = function () {
  console.log("端末の向きが " + screen.orientation.angle + "になりました。");
};

仕様書

Specification
Compatibility
# event-orientationchange

ブラウザーの対応

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
orientationchange event
Deprecated

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Deprecated. Not for use in new websites.