jQuery z-index和动画问题 [英] jQuery z-index and animate problem
问题描述
我有一些代码可使点击时的图片带有动画效果,然后向其添加z-index.
I've got some code which animates my images on click and then adds a z-index to it.
现在我需要的是,当我单击关闭按钮时,我需要它使它的动画恢复为原始状态,然后将z-index更改回原来的状态.
What I need now is to when I click the close button I need it to animate back to its original state and then change the z-index back to how it was.
当前,它会更改z-index并进行动画处理,因此看起来有些奇怪
Currently it changes the z-index and then animates so it looks a bit strange
有可能吗?
我尝试将delay
放在z-index更改之前,但是它仍然不起作用
I've tried putting a delay
before the z-index change but it still doesn't work
有什么想法吗?
推荐答案
http://jsfiddle.net/hD72c /1/已更新并修复
您需要做的就是在动画结束时将其更改为z-index: 1
作为回调,而不是在单击关闭时立即将其更改
All you need to do is change to z-index: 1
as a callback at the end of the animation rather then changing it straight away when close is clicked
这篇关于jQuery z-index和动画问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!