你如何能够使用 javascript 将页面中间的 css 链接注入(inject)到头部
<head>
... styles here
</head>
<body>
code
<link href='http://fonts.googleapis.com/css?family=Lato:400,300,700,900' rel='stylesheet' type='text/css'>
</body>
我需要某种 javascript 来将 google 字体推送到头部,最简单的方法是什么?
最佳答案
$('head').append("<link href='http://fonts.googleapis.com/css?family=Lato:400,300,700,900' rel='stylesheet' type='text/css'>");
试试这个,如果有效请告诉我。
关于javascript - 使用 javascript/jquery 将 css 链接注入(inject)头部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31921682/