簡體   English   中英

查詢是否已顯示類

[英]Query if class is already shown

您好我需要能夠識別給定的類是否已經“淡入”:

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.");
            }
        });
    }

我怎么做?

我不知道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.");
            }
        });
    }

}

gwtquery fadeIn完成顯示隱藏元素,因此$(selector).visible()應返回元素是否可見。

但通常情況下,如果你想要不運行兩個動畫,gquery和jquery中的常規方法是停止所有掛起的動畫。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM