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 GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
orientationchange event |
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.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.