Closed xbufan closed 7 years ago
检测浏览器是否支持横屏,window.orientation 已经不建议使用。并且在现代浏览器中,即使 'orientation' in window 返回false,window 实际上也可以绑定 orientationchange 事件。有一个实验性的特性,但是并没有被 Safari 支持。另外,参照这里,'ondevicemotion' in window 在 Chrome/FF 下是可以正确检测的。 希望检测的方法能完善一下。
'orientation' in window
window
orientationchange
'ondevicemotion' in window
'orientation' in window || 'orientation' in window.screen 这样就可以了吧
'orientation' in window || 'orientation' in window.screen
ondevicemotion是检测手机方向的 和这个不一样
检测浏览器是否支持横屏,window.orientation 已经不建议使用。并且在现代浏览器中,即使
'orientation' in window
返回false,window
实际上也可以绑定orientationchange
事件。有一个实验性的特性,但是并没有被 Safari 支持。另外,参照这里,'ondevicemotion' in window
在 Chrome/FF 下是可以正确检测的。 希望检测的方法能完善一下。