Skip to content

Instantly share code, notes, and snippets.

@heckctor
Created March 24, 2017 16:33
Show Gist options
  • Save heckctor/516316f2f21d31d1557279a47c2b423d to your computer and use it in GitHub Desktop.
Save heckctor/516316f2f21d31d1557279a47c2b423d to your computer and use it in GitHub Desktop.
detectar cambio de orientación con javascript
window.addEventListener("orientationchange", function() {
console.log("the orientation of the device is now " + screen.orientation.angle);
});
window.addEventListener("orientationchange", function() {
if (window.orientation == 90 || window.orientation == -90) {
console.log('landscape mode');
} else {
console.log('portrait mode');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment