Last active
August 29, 2015 14:06
-
-
Save KnightAlex/6ef4ff6754771de2a7dc to your computer and use it in GitHub Desktop.
Detect device rotation and reload page
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
// RELOADS WEBPAGE WHEN MOBILE ORIENTATION CHANGES | |
window.onorientationchange = function() { | |
var orientation = window.orientation; | |
switch(orientation) { | |
case 0: window.location.reload(); | |
break; | |
case 90: window.location.reload(); | |
break; | |
case -90: window.location.reload(); | |
break; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment