Reputation: 174
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 ');
}
Upvotes: 3
Views: 5277
Reputation: 5253
This isn't recommended but you could do:
$('body').css({
"-webkit-transform": "rotate(90deg)"
put other browsers here
});
or just in 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 */
}
Upvotes: 1