[jQuery] Re: End of animation

2009-08-05 Thread Leonardo K
Try this. $("#menu li:not(.selected)").animate({ marginLeft: "-200px" }, function() { if ($(this).is(':last')) { $("#menu").hide(); } }); On Wed, Aug 5, 2009 at 12:15, Mathieu wrote: > > Thanks for your answer Leonardo. > > The callback is not called once. > > $("#menu li:n

[jQuery] Re: End of animation

2009-08-05 Thread Mathieu
Thanks for your answer Leonardo. The callback is not called once. $("#menu li:not(.selected)").animate({ marginLeft: "-200px" }, function() { $("#menu").hide(); alert("Hello"); }); Hello gets printed many times. -- Mathieu On Aug 5, 3:29 pm, Leonardo K wrote: > Use th

[jQuery] Re: End of animation

2009-08-05 Thread Leonardo K
Use the callback function $("#menu li").click(function() { // toggle selected item in list $(this).toggleClass("selected"); // animate all other LI elements to disappear (sliding left) $("#menu li:not(.selected)").animate({ marginLeft: "-200px" }, function(){ $(