This file contains 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
/* -------------------------------------------- | |
* Detect device orientation | |
* and trigger changes based on it | |
--------------------------------------------*/ | |
function updateOrientation() { | |
// Detect whether device supports orientationchange event, otherwise fall back to the resize event | |
// Genius solution from http://stackoverflow.com/a/2307936 | |
let supportsOrientationChange = "onorientationchange"; | |
let orientationEvent = supportsOrientationChange ? "orientationchange" : "resize"; | |
let newAngle = null; |