gwt using jquery effect possible?

前端 未结 3 1014
旧时难觅i
旧时难觅i 2021-02-06 17:25

in my gwt, i have a button that fire like below to create new widget

 @UiHandler(\"buttonfire\")
  void addNewWidget(ClickEvent event) {


     htmlPanelHolder.a         


        
3条回答
  •  梦毁少年i
    2021-02-06 18:15

    It's also possible to create a fade in effect without using jQuery. If you want to do that, just write an Animation class like this:

    public class FadeInAnimation extends Animation {
        private final UIObject uiObject;
    
        FadeInAnimation(final UIObject uiObject) {
          this.uiObject = uiObject;
        }
    
        @Override
        protected void onUpdate(final double progress) {
          uiObject.getElement().getStyle().setOpacity(progress);
        }
    }
    

    Then you can use it on any widget:

    new FadeInAnimation(myWidget).run(5000);
    

    Note: The call to getStyle().setOpacity(..) even takes care of the special case IE6/7, where it sets style.filter = 'alpha(opacity=' + (value * 100) + ')';

提交回复
热议问题