jsdefer icon indicating copy to clipboard operation
jsdefer copied to clipboard

Support including css links

Open wforney opened this issue 13 years ago • 3 comments

Add support for including css links in the loader... Just for convenience of using one thing to include everything, and it is only a few more lines of code.

wforney avatar Apr 19 '11 16:04 wforney

Example:

loader.addCSS = function (url) {
    if (loader.scripts[url] == undefined) {
        loader.scripts[url] = { loaded: true, callbacks: [] };
        var link = document.createElement("link");
        link.setAttribute("rel", "stylesheet");
        link.setAttribute("type", "text/css");
        link.setAttribute("href", url);
        document.getElementsByTagName("head")[0].appendChild(link);
    }
};

wforney avatar Apr 19 '11 16:04 wforney

Also, maybe add a param for adding css to top or bottom of head.

wforney avatar Apr 19 '11 17:04 wforney

Yes we plan to include this feature in a future version

BorisMoore avatar Apr 25 '11 18:04 BorisMoore