JQuery Mobile Beta 1 is not resizing the screen on iphone when rotated to landscape

大憨熊 提交于 2020-01-11 03:07:16

问题


I am writing mobile app with JQUery Mobile Beta 1 and was expecting that the screen should adjust automatically on iphone when rotated from portrait to landscape and vice versa but it is not happening.

I simply checked with opening this link (Beta 1 doc demo)

http://jquerymobile.com/demos/1.0b1/docs/pages/page-template.html

but it is also not adjusting the screen.

Am I missing something?

EDIT: It seems to be same for Beta 2. I checked the demos & docs iPhone and it behaves similarly. I need to tap a screen to adjust it. Not doing automatically as in portrait orientation.

Itizme


回答1:


In your document <head> instead of doing this:

<meta name="viewport" content="width=device-width, initial-scale=1"> 

Do this:

<meta name="viewport" content="initial-scale=1, maximum-scale=1">

Why this works

When your device oritentation changes (i.e. when you rotate it) MobileSafari will zoom into the page before it resizes the viewport. So the zoom is applied based on the portrait screen width when it should just let the page resize on its own. By setting both initial and maximum scale to 1 we disable zooming. So MobileSafari can't zoom into your page incorrectly when you rotate, thereby fixing the problem.

Also see: jQuery Mobile bug report



来源:https://stackoverflow.com/questions/6992697/jquery-mobile-beta-1-is-not-resizing-the-screen-on-iphone-when-rotated-to-landsc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!