Created
February 16, 2017 11:28
-
-
Save defmech/1d493865396454642eff106cf1a114e9 to your computer and use it in GitHub Desktop.
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
function iPhoneVersion() { | |
var iHeight = window.screen.height; | |
var iWidth = window.screen.width; | |
if (iWidth === 320 && iHeight === 480) { | |
return "4"; | |
} | |
else if (iWidth === 375 && iHeight === 667) { | |
return "6"; | |
} | |
else if (iWidth === 414 && iHeight === 736) { | |
return "6+"; | |
} | |
else if (iWidth === 320 && iHeight === 568) { | |
return "5"; | |
} | |
else if (iHeight <= 480) { | |
return "2-3"; | |
} | |
return 'none'; | |
} | |
function isIphone() { | |
return !!navigator.userAgent.match(/iPhone/i); | |
} | |
if ( isIphone() && iPhoneVersion() === "6"){ | |
//code.. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment