Skip to content

Instantly share code, notes, and snippets.

@fysherman
Created October 26, 2021 15:41
Show Gist options
  • Save fysherman/5e11746c92f71b2fd52c87f97c973b27 to your computer and use it in GitHub Desktop.
Save fysherman/5e11746c92f71b2fd52c87f97c973b27 to your computer and use it in GitHub Desktop.
let orientation = 'portrait';
if(window?.screen?.orientation?.angle && [270, 90].includes(window.screen.orientation.angle)) {
orientation = 'landscape';
} else if(window.orientation && [90, -90].includes(window.orientation)) {
orientation = 'landscape';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment