Created
March 24, 2017 16:33
-
-
Save heckctor/516316f2f21d31d1557279a47c2b423d to your computer and use it in GitHub Desktop.
detectar cambio de orientación con javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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