Dynamically switching jQuery themes?

If I download multiple jQuery themes, how can I give users of my web application the ability to dynamically switch between themes?

+3
source share
2 answers

Nick Craver comment was right, themewitcher widget was perfect: http://jqueryui.com/docs/Theming/ThemeSwitcher new link: https://github.com/harborhoffer/Super-Theme-Switcher

+2
source

In addition to the topic, you can dynamically change the topic by deleting links to the current topic. Add new links with a new theme. The advantage is that you can change your own themes.

. Ansatz

<head>
<link href="./jquery-ui-first/jquery-ui.css" id="qtheme" rel="stylesheet">
<link href="./css/specials-first.css" id="mtheme" rel="stylesheet">
</head>

:

$(#otherthemebutton).click(function(){
    $("#qtheme").remove();
    $("#mtheme").remove();
    qelem = loadCss("./jquery-ui-other/jquery-ui.css","qtheme");
    qelem = loadCss("./css/specials-other.css","mtheme");
    document.getElementsByTagName("head")[0].appendChild(qelem);
    document.getElementsByTagName("head")[0].appendChild(melem);
});

loadCss = function(filename,id) {
    var elem=document.createElement("link");
    elem.id=id;
    elem.rel="stylesheet";
    elem.type="text/css";
    elem.href=filename;
    return elem;
}

, () javascript .

0

Source: https://habr.com/ru/post/1749376/


All Articles