I have been using jQuery\'s stop(true, true)
method to clear running animations so the next one starts immediately. I noticed that the first parameter, clearQ
Test for presence of class (set upon hover and removed on mouseOut animate callback) before staring new animation. When new animation does start, dequeue.
$("div").hover(function(){
if (!$(this).hasClass('animated')) {
$(this).dequeue().stop().animate({ width: "200px" });
}
}, function() {
$(this).addClass('animated').animate({ width: "100px" }, "normal", "linear", function() {
$(this).removeClass('animated').dequeue();
});
});