Toggle animate () in DIVs in same position

0

I was able to display a div , when hover , which is hidden and below visible. However, the effect gets a bit "crazy" when I move the mouse within container . Does anyone have a solution? = |

Full Code in JSFIDDLE

Thanks!

    
asked by anonymous 28.05.2014 / 23:56

1 answer

2

You need to add a stop () , before animate() , example:

$(this).stop().animate({
    top: "-200px"
}, 500);

When stop() is called on an element, the current animation is immediately interrupted. If more than one animation is called on the same element, they are put into the effects queue and the next animation will not start until the first one is completed, this avoids that unwanted effect.

JSFiddle

    
29.05.2014 / 00:20