I have called several animations to occur when a button is clicked. I want to toggle these animations, so that the elements return to their starting positions when clicked for a second time.
Here is my script:
$("span.click").click(function() {
$(".map").animate(
{"opacity": "1"}, 200);
});
$("span.click").click(function() {
$(".navigation").animate(
{"bottom": "-100px"}, 200);
});
$("span.click").click(function() {
$(".click").animate(
{"bottom": "150px"}, 200);
});
As you can see, three animations are occurring. What sort of if/else statement needs to be put into place in order to create reversible animations?
Here is a jsfiddle: http://jsfiddle.net/6arjhkzc/2/