I try to do divto invert and when hovering, i.e. mice enter and leave, respectively. However, when I entered and exited several times, I divcontinued to move back and forth mainly to the number of times I did freeze. See this jsFiddle example .
As you probably guessed, I hope to make a stop div(i.e., sliding) when the mouse is outside the element, no matter how many times I hush it up. I think something is missing in my understanding of jQuery animation.
$("#state-slider").hover(function() {
$(this).animate({
left: '0'
}, 500);
}, function() {
$(this).animate({ left: "-270" }, 500);
});
Thank.
source
share