web/js/loader.js
/**
 * Load a CSS file
 * 
 * @param {string} url - The url of the CSS file to load
 * @param {function} callback - the function to call when when the CSS is loaded
 */
Load a CSS file

@param {string} url - The url of the CSS file to load
@param {function} callback - the function to call when when the CSS is loaded
Load a CSS file @param { string } url - The url of the CSS file to load @param { function } callback - the function to call when when the CSS is loaded
function loadStyle(url, callback) {
    var head = document.getElementsByTagName('head')[0];
    var style = document.createElement('link');
    style.rel = 'stylesheet';
    style.href = url;
    style.onreadystatechange = callback;
    style.onload = callback;
    head.appendChild(style);
}
function loadStyle ( url , callback ) { var head = document . getElementsByTagName ( 'head' ) [ 0 ] ; var style = document . createElement ( 'link' ) ; style . rel = 'stylesheet' ; style . href = url ; style . onreadystatechange = callback ; style . onload = callback ; head . appendChild ( style ) ; }
Load a CSS file
Load a CSS file
// Adding the script tag to the head as suggested before // Then bind the event to the callback function. // There are several events for cross browser compatibility. // Fire the loading