$(window).height()false在iOS 5.1 PhoneGap 1.7 jquery手机在横向模式下启动应用程序 [英] $(window).height() false value on iOS 5.1 PhoneGap 1.7 jquery mobile when launching the app in landscape mode
问题描述
如果启动应用程序在纵向模式下持有iPhone,一切工作正常,即使我旋转iPhone一切仍然工作不错。
但是当我启动我的应用程序持有iPhone横向模式这不工作在我第一次旋转后景观发布,它完全废除了我的设计。
这是var viewport = $(window).height值的顺序:
启动纵向:
-
启动:$(window).height()= 460px / $(window).width()= 320px;
li>
-
旋转横向左侧:$(window).height()= 300px / $(window).width()= 480px;
-
旋转到纵向:$(window).height()= 460px / $(window).width()= 320px;
.....这样工作正常
启动横向:
-
启动横向左侧:$(window).height()= 300px / $(window).width()= 480px;
/ li>
-
旋转纵向:$(window).height()= 300px / $(window).width()= 480px;
这应该是:$(window).height()= 460px / $(window).width()= 320px; Launch: $(window).height() = 460px / $(window).width() = 320px;
Rotate Landscape left: $(window).height() = 300px / $(window).width() = 480px;
Rotate to portrait: $(window).height() = 460px / $(window).width() = 320px;
Launch landscape left: $(window).height() = 300px / $(window).width() = 480px;
Rotate portrait: $(window).height() = 300px / $(window).width() = 480px; This should be: $(window).height() = 460px / $(window).width() = 320px;
Rotate landscape left: $(window).height() = 460px / $(window).width() = 320px; This should be: $(window).height() = 300px / $(window).width() = 480px;
Rotate portrait: $(window).height() = 300px / $(window).width() = 480px; This should be: $(window).height() = 460px / $(window).width() = 320px;
Rotate landscape left: $(window).height() = 460px / $(window).width() = 320px; This should be: $(window).height() = 300px / $(window).width() = 480px;
旋转左侧的横向:$(window).height()= 460px / $(window).width()= 320px; 旋转纵向:$(window).height()= 300px / $(window).width()= 480px; 旋转左侧的横向:$(window).height()= 460px / $(window).width()= 320px; .....所以这完全毁了,因为第一次旋转动作没有改变它的值,现在的肖像设计是在风景,反之亦然。 / p> 感谢您的帮助,但请注意,同样的代码工作非常好Android设备。 Phonegap现在是2.2版本。升级到最新版本,其中包括许多旋转和方向的修复。有关详情,请参见 phonegap网站。 If if launch the application holding the iPhone in portrait mode, everything works fine even when i rotate the iPhone everything still working good.
But when i launch my app holding the iPhone in landscape mode this does not work good on my first rotation after landscape launch, it ruins my design completely.
This is the sequence of var viewport = $(window).height values: Launching Portrait: ..... So this is working fine Launching Landscape: ..... So this is ruined completely because of the first rotate action that didn't changed its values and now portrait design is on landscape and vice-versa. Thank you for helping but please note that the same code is working very good on android devices. Phonegap is on version 2.2 now. Upgrade to the latest version, which includes many fixes for rotation and orientation. See the phonegap website for more information. 这篇关于$(window).height()false在iOS 5.1 PhoneGap 1.7 jquery手机在横向模式下启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
这应该是:$(window).height()= 300px / $(window).width()= 480px;
这应该是:$(window).height()= 460px / $(window).width()= 320px;
这应该是:$(window).height()= 300px / $(window).width()= 480px; / ul>
function onBodyLoad(){
document.addEventListener(deviceready,onDeviceReady,false);
$(window).bind('orientationchange',function(){
if($ .mobile.activePage.attr(id)==FirstPage){
window.setTimeout(function(){
alert($(window).height()++ $(window).width());
},250);
}
});
}
function onBodyLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
$(window).bind('orientationchange', function () {
if ($.mobile.activePage.attr("id") == "FirstPage") {
window.setTimeout(function () {
alert($(window).height() + " " + $(window).width());
}, 250);
}
});
}