Last active
April 6, 2016 11:54
-
-
Save shrekuu/41bf862331b9142c21f9 to your computer and use it in GitHub Desktop.
Set default font-family according to operating system. 根据操作系统设置默认(中文)字体。
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
// @温柔的码农 | |
// reset font-family according to OS | |
(function () { | |
if (!navigator || !navigator.appVersion) { | |
return; | |
} | |
if (navigator.appVersion.indexOf("Win") != -1) { | |
// win 微软雅黑 | |
$('body').css('font-family', 'helvetica, arial, "Microsoft Yahei", simhei, sans-serif'); | |
return; | |
} | |
// mac 苹方, 苹果丽黑(冬青黑体) | |
if (navigator.appVersion.indexOf("Mac") != -1) { | |
$('body').css('font-family', '"San Francisco", helvetica, arial, "Pingfang SC", "Hiragino Sans GB", simhei, sans-serif'); | |
return; | |
} | |
// ubuntu 文泉驿微米黑 | |
if (navigator.appVersion.indexOf("X11") != -1 || navigator.appVersion.indexOf("Linux") != -1) { | |
$('body').css('font-family', 'helvetica, arial, "WenQuanYi Micro Hei", simhei, sans-serif'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment