An alternative is to look at it the other way round and say "whatever
animation is in progress, stop it and do what is now required", eg...

$(document).ready(function() {
        $("#control_panel li a").hover(
                function(){
                        $(this).stop().animate({paddingLeft: "50px"},
200);
                },
                function(){
                        $(this).stop().animate({paddingLeft: "0px"},
500);
        });

});

On Jun 1, 3:00 am, duck! <[EMAIL PROTECTED]> wrote:
> Perhaps you want to use .queue() to see if there is an animation already in
> progress before triggering a new one.
>
> untested, but something like this in the hover functions might be the go:
> if ($(this).queue("fx").length < 1) ...etc
>
> http://docs.jquery.com/Effects/queuefor more info
>
>
>
> next wrote:
>
> > how can i animate only static elements?
> > My code:
>
> > $(document).ready(function() {
> >    $("#control_panel li a").hover(
> >            function(){
> >                    $(this).animate({paddingLeft: "50px"}, 200);
> >            },
> >            function(){
> >                    $(this).animate({paddingLeft: "0px"},  500);
> >    });
> > });
>
> > This script slides hovered links to the right in my navigation list,
> > the problem is that if animation is still in progress jQuery still
> > registers hovering which causes unnecessary animation. You can test
> > this code with the follwing html:
>
> >    <ul id="control_panel">
> >            <li> # View Statistics </li>
> >            <li> # Create Counter </li>
> >            <li> # Embed Code </li>
> >            <li> # Help </li>
> >            <li> # About </li>
> >            <li> # Options </li>
> >            <li> # Log-Out </li>
> >    </ul>
>
> > If you play around with hovering those elements you'll get a better
> > understanding of my problem.
> > Thanks.
>
> --
> View this message in 
> context:http://www.nabble.com/don%27t-animate-elements-which-are-in-progress-...
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to