横屏模式

  • 如何使用JavaScript检测设备是否处于横屏模式?

    在JavaScript中,可以通过window.orientation属性或screen.orientation.type属性来检测设备是否处于横屏模式。window.orientation值为90或90,或者screen.orientation.type`值为”landscapeprimary”或”landscapesecondary”,则表示设备当前为横屏模式。

    2024年8月19日
    0