带有动画的 jQuery css 可见性 [英] jQuery css Visibility with animation

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

问题描述

我几乎没有放置在彼此下方的 div,我正在使用 css 可见性来淡入和淡出它们.我使用可见性的原因是为了使 div 不会移动位置.

I have few div's placed underneath each other and I'm using css visibility to fade them in and out. The reason why I use visibility is so that the div's don't move place.

对于淡入我正在使用:

$('.drop1').css({opacity: 0.0, visibility: "visible"}).animate({opacity: 1.0});

对于淡出我正在使用:

$('.drop1').css({opacity: 0.0, visibility: "hidden"}).animate({opacity: 1.0})}, 200);

淡入有效,但淡出无效.

现在,您可能认为问题是最后一个,200",但我需要将其用作延迟,因为 200 毫秒后淡出/可见性:隐藏在 mouseleave 事件上.

Now, you may think that the problem is the last ',200' but I will need to use that as a delay since the fadeout/visibility:hidden is on mouseleave event after 200ms.

所以我的问题是:如何将动画隐藏的可见性用作淡出.

So my question is: How can I do the visibility hidden with animation to act as a fadeOut.

非常感谢

推荐答案

$('.drop1').css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0}, 200);

这篇关于带有动画的 jQuery css 可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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