Search code examples
jquerygwtgwtquerygquery

Query if class is already shown


Hello I need to be able to identify if a given class is already "faded in":

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

How do I do that?


Solution

  • gwtquery fadeIn finishes showing a hidden element so $(selector).visible() should return whether the element is visible.

    But normally, if you want to take care of not running two animations, the normal way in gquery and jquery is stop all pending animations.

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