我已经搜索了好几天,想找到一种方法,在横屏模式下始终只显示一个特定的jQuery Mobile页面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 ');
}
<div data-role="page" id="landscape" data-theme="a" data-content-theme="a" data-add-back-btn="true">
我希望这个 div 始终处于横屏状态,即使手机处于竖屏状态。 - lmac34