Skip to content

Instantly share code, notes, and snippets.

@lenivene
Last active July 10, 2018 16:28
Show Gist options
  • Save lenivene/f29bcfa0602605dd69c8ed7861118c8d to your computer and use it in GitHub Desktop.
Save lenivene/f29bcfa0602605dd69c8ed7861118c8d to your computer and use it in GitHub Desktop.
Cross browser screen lock orientation
var win = window,
lockOrientation = win.screen.lockOrientation || win.screen.mozLockOrientation || win.screen.msLockOrientation || function(){
return null;
}
if( lockOrientation ){
/**
* Parameters
* [ portrait-primary, portrait-secondary, landscape-primary, landscape-secondary, portrait, landscape, default ]
*/
lockOrientation('portrait');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment