问题
I'm trying to reset the CSS position of an element after it's been animated, but failing.
I've tried using stop(), queue:false, and specifying the css position to use after the animation is complete but none of these methods are working. Can anyone help?
I've simplified my code and posted here: http://jsfiddle.net/DSs6r/
Rapidly move your mouse in and out of the red block and you'll see that things queue up after a while and the position of top: 0px; is not maintained.
回答1:
If you want you can specify the exact values to change top to instead of += and -=
http://jsfiddle.net/Paulpro/DSs6r/2/
I'm not sure if this helps you for whatever you're using this for though.
来源:https://stackoverflow.com/questions/6727519/jquery-reseting-a-position-after-animation