Looking at the API the animate does have a callback function that you
can use to do the stuff after the animation completes, for example

$('#navigation').mouseout(
        function() {
          if(state == 1) {
                $(this).animate({left: '-210'},'slow',
'easein',function(){
                      //do stuff after animate finishes here
                      });
                state = 0;
               }
         }
    );

http://docs.jquery.com/Effects/animate


On Sep 1, 11:22 am, Mario <sevenartwo...@googlemail.com> wrote:
> ok, i tried this and this works fairly. but another question is:
> can i change the state AFTER the animate() is finished?
> (there are still some problem when i touch certain points while
> sliding)
>
> $(function(){
>
>         var state = 0;
>
>         $('#navigation').mouseover(
>         function() { if(state == 0) {$(this).animate({left: '0'},
> 'slow'); state = 1;}}
>     );
>
>         $('#navigation').mouseout(
>         function() { if(state == 1) {$(this).animate({left: '-210'},
> 'slow'); state = 0;}}
>     );
>
> });

Reply via email to