benhowdle89
benhowdle89

Reputation: 37464

jQuery intercept slideToggle()

I'm doing a very simple slideToggle() here:

            $("#loginBtn").click(function(){
                $("#login").slideToggle();
                return false;
            });

What i'm asking is, how do i intercept the slideToggle, so once the user clicks #loginBtn and #login slides down, they can either click #loginBtn again to slide it up OR they can click another element to slide #login up? But only the #loginBtn slides down the #login?

Thanks

Upvotes: 2

Views: 139

Answers (1)

karim79
karim79

Reputation: 342635

Bind some slideUp goodness to your 'other elements'?

$(".otherButtons").click(function() {
    $("#login").slideUp();            
    return false;
});

Upvotes: 2

Related Questions