How to change orientation of a single view in app

need single view with landscape orientation only otherwise app should run in portrait mode only.

2 Likes

Yeah. I am also facing the same issue. No Solution found yet.

i have tried doing it by using custom css.
but how can i make the header and footer go in landscape mode.

Check this post.

See this blog post for ideas
http://www.raymondcamden.com/index.cfm/2014/5/24/PhoneGap-Tip-Temporarily-changing-orientation-for-video-in-a-portrait-only-application#more

@darrenahunter @mhartington
Thank you very much, it worked…

Hi @Sudhindra_C, do you still remember how you made it to work? I am facing the same issue, that I want to show a view in the landscape mode. Appreciate it if you could share the solution.

@yli1001 really sorry for the late reply :grin:

Use this plugin as you wish https://github.com/gbenvenuti/cordova-plugin-screen-orientation

Add plugin and use it like this anywhere, a simple if condition in app or config file will your job :
// set to either landscape
screen.lockOrientation(‘landscape’);

// allow user rotate
screen.unlockOrientation();

// access current orientation
console.log('Orientation is ’ + screen.orientation);

cordova plugin add https://github.com/gbenvenuti/cordova-plugin-screen-orientation

3 Likes

Thanks a lot. Worked for me too :slight_smile:

Justo lo que estaba buscando. Gracias!