Kevin Compton
Kevin Compton

Reputation: 746

needing to click twice with jquery toggle

I must have some problem with my method of toggling, but I'm getting an issue where once my toggle is activated I have to click each button twice to get an action. Im using a class to assign the toggle function to two links.

$(function() {
    $(".partyToggle").toggle(
        function() { 
            $("#wheres-the-party").animate({"height": "450px", "margin-bottom": "0px"}, 500); 
            $("#mapCta").delay(500).animate({"opacity": "0"}, 500);
            $(".partyToggleClose").delay(500).animate({"height": "50px"}, 500); 
        },
        function() { 
            $("#wheres-the-party").delay(500).animate({"height": "200px", "margin-bottom": "0"}, 500); 
            $("#mapCta").animate({"opacity": "1"}, 500);
            $(".partyToggleClose").delay(500).animate({"height": "0"}, 500); 
        }
    );

});

Upvotes: 1

Views: 1486

Answers (1)

test
test

Reputation: 2466

you need $(".partyToggle").unbind('click'); before the function.

Upvotes: 1

Related Questions