【问题标题】:changing a theme (not working)更改主题(不起作用)
【发布时间】:2014-05-10 06:22:17
【问题描述】:

我正在为我的项目应用不同的主题。我维护了 2 组 css 文件,1 组 css 文件包含 RED 主题,另一组包含 BLUE 主题,一旦用户选择它应该影响每个 jsp 页面的主题选项。但我面临的问题是所选主题仅影响当前页面而不是所有页面。

MainMenu.jsp

$(window).load(function(){
     $('.blueTheme').click(function (){

           $('link[href="css/mainDiv.css"]').attr('href','css-blue/mainDiv.css');
           $('link[href="css/style.css"]').attr('href','css-blue/style.css');
           $('link[href="css/style12.css"]').attr('href','css-blue/style12.css');
           $('link[href="css/templatemo_style.css"]').attr('href','css-blue/templatemo_style.css');

        });
        $('.redTheme').click(function (){
           $('link[href="css-blue/mainDiv.css"]').attr('href','css/mainDiv.css');
           $('link[href="css-blue/style.css"]').attr('href','css/style.css');
           $('link[href="css-blue/style12.css"]').attr('href','css/style12.css');
           $('link[href="css-blue/templatemo_style.css"]').attr('href','css/templatemo_style.css');
        });
});  

我正在调用 MainMenu.jsp 到剩余的页面。

【问题讨论】:

    标签: css jsp


    【解决方案1】:

    如果您想保留所选主题,您需要将所选颜色放在某处,然后在其他主题 jsps 中从那里读取。如果它可以是暂时的,你可以使用session,如果你需要它是持久的(例如,如果用户注销)它必须在数据库上。根据您的要求,cookie 也可以完成这项工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-23
      • 2019-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多