Jquery mobile 设备:强制定向横向(Phonegap JQueryMobile)

Jquery mobile 设备:强制定向横向(Phonegap JQueryMobile),jquery-mobile,cordova,screen-orientation,Jquery Mobile,Cordova,Screen Orientation,几天来,我一直在寻找一种在横向模式下始终只显示一个特定jquery移动页面div的方法 如果有任何例子或想法能对你有所帮助,我将不胜感激 function forceLandscape() { console.log('Starting: forceLandscape '); console.log('----------------------------------------------------'); // var orientation = wind

几天来,我一直在寻找一种在横向模式下始终只显示一个特定jquery移动页面div的方法

如果有任何例子或想法能对你有所帮助,我将不胜感激

function forceLandscape() {
    console.log('Starting: forceLandscape ');
    console.log('----------------------------------------------------');


    //    var orientation = window.orientation;
    //    var new_orientation = 0;
    //    switch (orientation) {
    //        case 90:
    //            break;
    //        case -90:
    //            new_orientation = 180
    //            $('body').css({ ".ui-mobile,.ui-mobile .ui-page{min-height:300px} -webkit-transform": "rotate(" + new_orientation + "deg);" });
    //            break;
    //        case 180:
    //            new_orientation = 270;
    //            $('body').css({ ".ui-mobile,.ui-mobile .ui-page{min-height:300px} -webkit-transform": "rotate(" + new_orientation + "deg);" });
    //            break;
    //        case 0:
    //            new_orientation = 90;
    //            $('body').css({ ".ui-mobile,.ui-mobile .ui-page{min-height:300px} -webkit-transform": "rotate(" + new_orientation + "deg);" });
    //            break;
    //        default:
    //            $('body').css({ ".ui-mobile,.ui-mobile .ui-page{min-height:300px} -webkit-transform": "rotate(" + new_orientation + "deg);" });
    //    }  


    console.log('----------------------------------------------------');
    console.log('Completed: forceLandscape ');
}

不建议这样做,但您可以这样做:

$('body').css({
   "-webkit-transform": "rotate(90deg)"
   put other browsers here
}); 
或者只是在css中

#page {
transform:rotate(90deg);
-ms-transform:rotate(90deg); /* IE 9 */
-moz-transform:rotate(90deg); /* Firefox */
-webkit-transform:rotate(90deg); /* Safari and Chrome */
-o-transform:rotate(90deg); /* Opera */
}

带有jquery手机页面的页面具有横向方向?
我希望此div始终处于横向位置,即使手机在Portal中。我有一些类似于上一个的东西,我得到了奇怪的结果。奇怪是什么意思?你能详细说明一下吗?谢谢你回复我,页面正在旋转,但其高度和宽度不正确。页面保持了原来的宽度,两边以白色边框居中。codaniel你有css工作的例子吗,我也在使用960网格格式的jquery mobile,我认为这可能是问题的原因。@lmac34您必须添加一个事件侦听器,然后根据
window.height
window.width
更改内容。