[jQuery] End of animation

[jQuery] End of animation


Hi all,
I would like to know when a set of animations, started inside an
"each" function, is finished.
In the following example, how can I simply hide the whole #menu
element once LI elements have been fully animated ?
------------------- HTML
<div id="menu">
    <ul>
        <li>One</li>
        <li>Two</li>
        <li>Three</li>
        <li>Four</li>
    </ul>
</div>
------------------- JS
// add click behaviour
$("#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)").each(function(index, domElement) {
        $(this).animate({
            marginLeft: "-200px"
        });
    });
});