Skip to content

Instantly share code, notes, and snippets.

@zhuochun
Last active December 18, 2015 21:59
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 zhuochun/5851439 to your computer and use it in GitHub Desktop.
Save zhuochun/5851439 to your computer and use it in GitHub Desktop.
function loadCss(css) {
var link;
if ($.isArray(css)) {
$.each(css, function (idx, lk) {
loadCss(lk);
});
} else {
link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = css;
document.getElementsByTagName("head")[0].appendChild(link);
}
};
function loadFile(url) {
var script = document.createElement('script');
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment