Skip to content

Instantly share code, notes, and snippets.

@oslego
Created March 8, 2011 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oslego/860278 to your computer and use it in GitHub Desktop.
Save oslego/860278 to your computer and use it in GitHub Desktop.
Load any number of CSS files to the current document's head.
//Loads CSS files into the head of the current document
//using arguments to reference any number of styles
function loadStyles(){
var i = 0,
d = document,
s = d.createElement("link"),
h = d.getElementsByTagName('head')[0],
createStyle = function(src){
s = s.cloneNode(false);
s.rel ="stylesheet";
s.type = "text/css";
s.href = src;
h.appendChild(s);
}
for (i; i < arguments.length; i++){
createStyle(arguments[i])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment