Jquery:如何睡觉或延迟? [英] Jquery: how to sleep or delay?
本文介绍了Jquery:如何睡觉或延迟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想向上移动物体,延迟1000毫秒,然后隐藏它,
i want move up the object, delay 1000ms , then hide it,
我得到的代码:
$("#test").animate({"top":"-=80px"},1500)
.animate({"top":"-=0px"},1000)
.animate({"opacity":"0"},500);
我使用.animate({top: - = 0px},1000)为了实现延迟,这不好。
i use ".animate({"top":"-=0px"},1000)" to implement delay, it's not good.
我想:
$("#test").animate({"top":"-=80px"},1500)
.sleep(1000)
.animate({"opacity":"0"},500);
任何想法?
推荐答案
.delay()
怎么样?
$("#test").animate({"top":"-=80px"},1500)
.delay(1000)
.animate({"opacity":"0"},500);
这篇关于Jquery:如何睡觉或延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文