jQuery Reseting a position after animation

亡梦爱人 提交于 2019-12-11 07:58:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!