你怎么淡出使用jQuery的元素之前暂停? [英] How do you pause before fading an element out using jQuery?

查看:153
本文介绍了你怎么淡出使用jQuery的元素之前暂停?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想换一个成功的消息我的网页上。

I would like to flash a success message on my page.

我使用jQuery 淡出方法褪色,然后删除元素。我可以增加时间,使其持续更长的时间,但是这看起来怪怪的。

I am using the jQuery fadeOut method to fade and then remove the element. I can increase the duration to make it last longer, however this looks strange.

我想发生的情况是有元素显示五秒钟,然后很快消失,最后被删除。

What I would like to happen is have the element be displayed for five seconds, then fade quickly, and finally be removed.

你怎么能这样动画使用jQuery?

How can you animate this using jQuery?

推荐答案

新的延迟()功能的jQuery 1.4应该做的伎俩。

The new delay() function in jQuery 1.4 should do the trick.

$('#foo').fadeIn(200).delay(5000).fadeOut(200).remove();

这篇关于你怎么淡出使用jQuery的元素之前暂停?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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