I have a function that loads multiple CSS files
function loadCSS(stylesheets)
{
for( i = 0; i < stylesheets.length; i++ )
{
var stylesheetEl = document.createElement("link");
stylesheetEl.rel = "stylesheet";
stylesheetEl.type = "text/css";
stylesheetEl.href = stylesheets[i];
document.head.appendChild(stylesheetEl);
}
}
But there's no way to tell when they're all loaded because they aren't loaded synchronously.
So how can I load one file, wait for all of the CSS to load completely, go to the next file etc?