orientationchange 事件在設備方向改變時被觸發。

冒泡 No
可取消 No
介面 Event
事件處理器 onorientationchange

範例

可於 addEventListener 方法中使用 abort 事件:

window.addEventListener("orientationchange", function() {
  console.log("the orientation of the device is now " + screen.orientation.angle);
});

或使用 onorientationchange 事件處理器屬性:

window.onorientationchange = function() { 
  console.log("the orientation of the device is now " + screen.orientation.angle);
};

規範

Specification Status
Compatibility Standard
The definition of 'orientationchange' in that specification.
Living Standard

瀏覽器相容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
orientationchange event
Deprecated
Chrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 44Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

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

文件標籤與貢獻者

標籤: 
此頁面的貢獻者: jackblackevo, fscholz, mdnwebdocs-bot, BwayCer
最近更新: jackblackevo,