Reset scale/width/zoom of Safari on iPhone using JavaScript/onorientationchange

前端 未结 7 1132
臣服心动
臣服心动 2021-02-02 00:24

I am displaying different content depending on how the user is holding his/her phone using the onorientationchange call in the body tag. This works great - I hide one div while

7条回答
  •  时光说笑
    2021-02-02 01:17

    The "answer" accepted above is not really an answer, in that disallowing any zooming whatsoever is as bad as asking an IE user to switch to another browser. It's terrible for accessibility. You want to your design to not do funky zoom things that Apple has deemed ideal upon switching view orientation, but you are leaving disabled users in the dust. Highly not recommended.

    Try using media queries or a js hook (screen.width, etc) to adjust your design automatically upon orientation change. It's why these attributes are exposed to us as developers.

提交回复
热议问题