GWT Bootstrap3动态主题 [英] GWT Bootstrap3 dynamic theme

查看:87
本文介绍了GWT Bootstrap3动态主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用GWTBootstrap3动态更改引导主题。我不知道从哪里开始看,所以我根本没有尝试过任何东西。我找到了一个旧gwt-boostrap的过时文章。但我发现bootstrap3的所有内容都是这个 [ ^ ]仅显示如何附加主题。我需要能够根据代码中的变量切换它。

I'm trying to dynamically change bootstrap themes with GWTBootstrap3. I'm not sure where to start looking, so I haven't tried anything at all. I found an outdated article for the older gwt-boostrap. But all I've found for bootstrap3 is this[^] which only shows how to attach a theme. I need to be able to switch it based on variables in the code.

推荐答案

我改变了我的bootstrap include到notheme:



I changed my bootstrap include to notheme:

<inherits name="org.gwtbootstrap3.GwtBootstrap3NoTheme" />





然后我用一个函数来加载我想要的css:





and then I used a function to load the css that I wanted:

public static native void loadCss(String url)/*-{
        var fileref=document.createElement("link");
        fileref.setAttribute("rel","stylesheet");
        fileref.setAttribute("type","text/css");
        fileref.setAttribute("href", url);


doc.getElementsByTagName(head)[0] .appendChild(fileref);
} - * / ;
doc.getElementsByTagName("head")[0].appendChild(fileref); }-*/;





如果你想使用股票主题,你必须也可以使用此方法手动加载。



If you want to use the stock theme, you'll have to load it manually as well using this method.


这篇关于GWT Bootstrap3动态主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆