Toggle animation?
问题 I have this code: $('.couch-hide').click(function() { $(this).animate({right:0},1000, 'easeOutBounce'); }); I am trying to get it to toggle, so on first click, pop it out, then click again, and place it back inside. Would i need to set a variable as a tracker? To tell what stage it is at? 回答1: Just save the original value somewhere, and remember to stop any in-progress animation before starting a new one. The animation routines will take care of the rest: var panel = $('.couch-hide'); var