0

Hi hope you can help me,

im trying to create a toggle effect that will animate and display a element in my webpage. however when clicking said div it will only activate the second function as opposed to toggling through the desired functions my code is bellow.

function toggle(id){

        $(id).toggle(
            function(){
                alert('toggle 1');
                //$(id).animate({heigt: "220"}, 500);
                //$('#sub_menu').css({"color": '#AAA'});
            },
            function(){
                alert('toggle 2');
                //$(id).animate({heigt: "0"}, 500);
                //$('#sub_menu').css({"color": '#333'});
            }
        );

    };

at the moment when ever function is executed only the toggle 2 alert will pop up. I need it to taggle between alert1 then alert 2 then alert 1 and so on.

andrew hutchings
  • 343
  • 1
  • 5
  • 18

0 Answers0