jQuery z-index和动画问题 [英] jQuery z-index and animate problem

查看:99
本文介绍了jQuery z-index和动画问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代码可使点击时的图片带有动画效果,然后向其添加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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆