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:
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()
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(){
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
4 matches
Mail list logo