I have a div element that on the click of a link slide in from the right and slides to the left, the works great, I am now trying to get so that if the link is clicked again it runs the animation in reverse, I have tried add a class to the link when the animation runs and then doing the same animation but backwards, but that does not work I get no response, can any give me any tips etc?
$('a.contact').click(function() {
$('#contact').animate({marginLeft:'500px'}, {queue:false, duration:'7000'});
$('#contact').animate({width:'500px'}, {duration:'7000'});
$('a.contact').css()
$('a.contact').animate({marginLeft:'-500px'}, '250');
$('a.contact')addClass('open');
return false;
});