jQuery SlideToggle - Detect open / closed

0

I would like to remove the "active" class from "liToggle" if a SlideToggle were closed.

I tried to use is(':hidden') but to no avail. If I post it right after the open conditional, it closes at the same time. I have no ideas for logic.

Can anyone help me?

$("aside #menu-busca ul > li a").click(function(){
    if($(this).attr('href') == "#"){

        var ulToggle = $(this).parent().children("ul");
        var liToggle = $(this).parent();
        ulToggle.slideToggle("slow");

        // * Se estiver aberto
        if (ulToggle.is(":visible")){
            $(liToggle).addClass("ativo");
        }

        return false;
    }
});
    
asked by anonymous 15.02.2017 / 03:01

0 answers