开发者

Dynamically Modify CSS from GWT

开发者 https://www.devze.com 2023-01-04 08:24 出处:网络
for example I have a css in test.css given below. .test { 开发者_运维百科top:100px; } how can i increment top property from GWT ?e.g. you can retrieve the Style of the element and alter that.

for example I have a css in test.css given below.

.test {

开发者_运维百科  top:100px;

 }

how can i increment top property from GWT ?


e.g. you can retrieve the Style of the element and alter that. other type of widgets might have other functionalities


You can hold value in memory and just set it at any time you need it via runtime substitution which is built-in GWT feature.

@eval userBackground com.module.UserPreferences.getUserBackground();
div {
   background: userBackground;
}

public class UserPreferences {
    public static String getUserBackground() {
        return "#FF0000";
    }
}

Please check GWT specs: http://www.gwtproject.org/doc/latest/DevGuideClientBundle.html#Runtime_substitution

0

精彩评论

暂无评论...
验证码 换一张
取 消