查询是否已显示类

时间:2014-03-06 09:00:02

标签: jquery gwt gwtquery gquery

你好我需要能够识别给定的类是否已经“淡入”:

private void fadeIn() {
        // TODO: Check first if class is already shown! otherwise, don't run this as it fade's out when it is run over a already faded in class
        $(".hopscotch-bubble").fadeIn(new com.google.gwt.query.client.Function() {
            @Override
            public void f() {
                JSNIHelper.infoNotify("INFO", "Fade in method invoked.");
            }
        });
    }

我该怎么做?

2 个答案:

答案 0 :(得分:1)

我不知道java,无论如何我的概念是分配一个变量并检查变量是否为真,如果为true则调用函数如下所示:

private void fadeIn() {
        // TODO: Check first if class is already shown! otherwise, don't run this as it fade's out when it is run over a already faded in class
var faded = 1;
if(faded){ 
faded = 0;       
$(".hopscotch-bubble").fadeIn(new com.google.gwt.query.client.Function() {
            @Override
            public void f() {
                JSNIHelper.infoNotify("INFO", "Fade in method invoked.");
            }
        });
    }

}

答案 1 :(得分:1)

gwtquery fadeIn完成显示隐藏元素,因此$(selector).visible()应返回元素是否可见。

但通常情况下,如果您想要处理不运行两个动画,gquery和jquery中的常规方法是停止所有待处理的动画。

$(selector).stop(true).fadeIn(...);