Created
December 12, 2012 23:52
-
-
Save anova/4272820 to your computer and use it in GitHub Desktop.
Parallel loading for css files. I need this for font embedding css files.
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
//this script is inline for avoid extra request. | |
var fonts = new Array(); | |
fonts.push('css/font/pfsquaresanspromedium.css'); | |
fonts.push('css/font/pfhighwaysanspro-thin.css'); | |
fonts.push('css/font/ubuntu-m.css'); | |
fonts.push('css/font/pfhighwaysanspro-regular-light-italic.css'); | |
fonts.push('css/font/pfsquaresanspro-italic-regular.css'); | |
var head = document.getElementsByTagName('head')[0]; | |
var link = document.getElementsByTagName('link')[0]; | |
for(var i in fonts) { | |
var s = document.createElement('link'); | |
s.rel = 'stylesheet'; | |
s.href = fonts[i]; | |
head.insertBefore(s, link); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment