Created
November 5, 2010 09:49
-
-
Save necolas/663896 to your computer and use it in GitHub Desktop.
Create and append style sheets to document <head> using JavaScript
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
(function() { | |
var css = [ | |
'/css/default.css', | |
'/css/section.css', | |
'/css/custom.css' | |
], | |
i = 0, | |
link = document.createElement('link'), | |
head = document.getElementsByTagName('head')[0], | |
tmp; | |
link.rel = 'stylesheet'; | |
for(; i < css.length; i++){ | |
tmp = link.cloneNode(true); | |
tmp.href = css[i]; | |
head.appendChild(tmp); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome!