Created
January 18, 2013 12:26
-
-
Save orioltf/4564276 to your computer and use it in GitHub Desktop.
#JS: iOS detection. Adds an "ios" class to <html> if device is iOS
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
if ( navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ) { | |
document.documentElement.className += " ios"; | |
} |
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
/** | |
* iOS: display iphone elements only to ios devices. Hide them in other devices. | |
*/ | |
.iphone {display: none;} | |
.ios .iphone {display: block;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment