Change orientation on Phonegap jQuery mobile

Hi, I am writing a simple application using jqm and phonegap, and I have some problems with change orientation. I need to change the orientation on one page. I can change the "Supported Orientation Orientations" values, but it works on all pages, can there be a way to change the orientation on one page?

+3
source share
2 answers

You can use this plugin.

https://github.com/champierre/pg-plugin-screen-orientation

To lock the screen to Landscape:

navigator.screenOrientation.set('landscape');

To lock the screen to the "Portrait" position:

navigator.screenOrientation.set('portrait');

To unlock:

navigator.screenOrientation.set('fullSensor');
+4
source

, : https://github.com/apache/cordova-plugin-screen-orientation

( cordova > 4) :

cordova plugin add cordova-plugin-screen-orientation

:

phonegap plugin add cordova-plugin-screen-orientation

:

screen.lockOrientation('portrait')
screen.lockOrientation('landscape')

Android iOS.

0

All Articles