Skip to content

lukKowalski/loadCSS

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

loadCSS

A function for loading CSS asynchronously [c]2014 @scottjehl, Filament Group, Inc. Licensed MIT

Usage

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.

About

A function for loading CSS asynchronously

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages