Created
January 18, 2016 08:11
-
-
Save nick1m/c83181c405e88a72d13d to your computer and use it in GitHub Desktop.
определяем мобильный на JavaScript
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
// Определяем устройство | |
var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())); | |
if(mobile){ | |
// Создаем ссылку на CSS | |
var cssLink = document.createElement("link"); | |
cssLink.setAttribute("type", "text/css"); | |
cssLink.setAttribute("rel", "stylesheet"); | |
cssLink.setAttribute("href", "css/mobile.css"); | |
document.head.appendChild(cssLink); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment