Device: Orientation Orientation (Phonegap JQueryMobile)

I've been looking for days for always only showing one specific div section for jquery mobile pages in landscape mode.

Any any examples or ideas that might 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 ');
}

      

+3


source to share


1 answer


This is not recommended, but you can 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 */
}

      

+1


source







All Articles