[jQuery] Re: don't animate elements which are in progress of animation?

2008-06-01 Thread Wizzud
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:

[jQuery] Re: don't animate elements which are in progress of animation?

2008-06-01 Thread Ambient.Impact
The easiest way to do this is using the .is() method and the :animated selector: if (!$(this).is(':animated')) { (only runs if the element isn't being animated) } Also, if you do want to run anyways, but cancel all current animations, you've got to add a little bit to the above, as .stop()

[jQuery] Re: don't animate elements which are in progress of animation?

2008-06-01 Thread next
I actually solved my problem with stop() function, here's the exact code: $(document).ready(function() { $(#control_panel li).hover( function(){ $(this).stop().animate({marginLeft: 50px}, 50); }, function(){

[jQuery] Re: don't animate elements which are in progress of animation?

2008-05-31 Thread duck!
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/queue for more info next