Last active
April 6, 2019 15:50
-
-
Save n1ckfg/d8d1de678a8a70ed96c2efed442f0bce to your computer and use it in GitHub Desktop.
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
| function detectMobile() { | |
| if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } | |
| function detectPortrait() { | |
| if (Math.abs(window.orientation) === 90) { | |
| return false; | |
| } else { | |
| return true; | |
| } | |
| } | |
| function detectMobilePortrait() { | |
| if (detectMobile() && detectPortrait()) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment