Move span with jquery

Asked

Viewed 36 times

0

I’m making a span move when I put the mouse over a button, and when I take the mouse it goes back to initial position. I am using the jquery’s Animate class, the only problem is that when I pass the mouse several times over the button it keeps running the animation several times. What I wanted to do is, when I move the mouse over and out, if I pass over again the function continue from where the span is.

This is my code:

$("button#icone-seta-move").mouseover(function(){ $("span#icone-seta").animate({"margin-left":"207px", "opacity":"1"},400); }); $("button#icone-seta-move").mouseout(function(){ $("span#icone-seta").animate({"margin-left":"190px", "opacity":"0"},400); });

  • Have you tried $("span#icone-seta").stop().animate(...) ?

  • The problem is not to stop the animation, I want it to continue where it left off, for example :Hover in css for example: if you will change the color of a boot and put to change from white to black in 1s. if you put the mouse and take several times, it will always continue the transition from where it stopped.

  • I got here I used . Hover() from jquery, I did like this: $("button#icone-arrow-move"). Hover();

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.