设备:强制取向景观(Phonegap JQueryMobile) [英] Device: force orientation landscape (Phonegap JQueryMobile)
本文介绍了设备:强制取向景观(Phonegap JQueryMobile)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在寻找一种方式,总是只显示一个特定的jquery移动页面div在横向模式。
I have been searching for days for a way to always display just one particular jquery mobile page div in landscape mode.
任何人的任何例子或想法,可以帮助,我真的很感激。
Anyone any examples or ideas that could help, I would really appreciate it.
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 */
}
这篇关于设备:强制取向景观(Phonegap JQueryMobile)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文