A function for loading CSS asynchronously [c]2014 @scottjehl, Filament Group, Inc. Licensed MIT
Place the loadCSS function inline in the head of your page (it can also be included in an external JavaScript file if preferable).
Then call it by passing it a stylesheet URL.
<head>
...
<script>
loadCSS( href, before ){ ... }
// load a file
loadCSS( "path/to/mystylesheet.css" );
</script>
...
</head>By default, your stylesheet will be inserted before the first script tag in the DOM (which may be the one shown above). If you need another insert location, use the optional before argument to specify a different sibling element. The stylesheet will be inserted before the element you specify.