freekir
1/29/2019 - 11:17 AM

Добавление динамически стилей в хед

    var head = document.head, 
    link = document.createElement('link');
    link.type = 'text/css';
    link.rel = 'stylesheet';
    link.href = '/content/toastr.css';
    head.appendChild(link);
var sc = document.createElement("script");
sc.setAttribute("src", "https://getfirebug.com/firebug-lite.js");
sc.setAttribute("type", "text/javascript");
document.head.appendChild(sc);
var arrayLink = ['/css/mobile.css?v=4', '/css/uniform.css', '/css/site_mobile.css', '/content/toastr.css', '/css/slick.css'];
for (var iLink in arrayLink) {
    var head = document.head, 
    link = document.createElement('link');
    link.type = 'text/css';
    link.rel = 'stylesheet';
    link.href = arrayLink[iLink];
    head.appendChild(link);
}