用jQuery在x秒后淡出div [英] fade out div after x seconds with jquery
本文介绍了用jQuery在x秒后淡出div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在加载页面时不显示淡入淡出的颜色:
I do a fade in div that is not displayed when I load the page:
$('#overlay').fadeIn('fast');
$('#box').fadeIn('slow');
我会在x秒后执行此说明,然后对div进行fadeOut:
I would do this instructions after x seconds, doing a fadeOut of the div:
$('#overlay').fadeOut('fast');
$('#box').hide();
我该怎么办? 实际上,淡出是通过单击按钮完成的.
How can I do it? Actually fadeOut is done on button click.
脚本在此处: http://clouderize.it/cookie-localstorage/a.php 当我单击另一张图像时出现的div将在x秒后消失. 非常感谢.
The script is here: http://clouderize.it/cookie-localstorage/a.php The div that appear when I click on another image will disappear after x seconds. Thanks a lot.
推荐答案
.delay
方法旨在用于您正在描述:
The .delay
method is purpose built for what you are describing:
$('#overlay').fadeIn('fast').delay(1000).fadeOut('fast');
$('#box').fadeIn('slow').delay(1000).hide(0);
这篇关于用jQuery在x秒后淡出div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文