You can use stop() to stop the animation currently in the queue. Note that stop() stops any current animation, wherever it is, so in this case we need to stop the animation and .
(As before, before you solve the behavior problem, you might already want to use stop() to prevent the bounce effects if the user inserts and removes the button very quickly):
$("#button").hover(function(){ $("#info").stop(true,true).slideDown("fast"); }, function(){
Then, to get the desired behavior, we need to add a hover handler to #info , which stops the current animation, and then either displays or hides the information element, if necessary. Since we already have a handler that does this, you can simply add the #info selector to the hover call:
$("#button, #info").hover(function(){ $("#info").stop(true,true).slideDown("fast"); }, function(){
Here's a working jsfiddle
Timothy jones
source share