在功能运行之间产生延迟 [英] create a delay between the running of functions

查看:62
本文介绍了在功能运行之间产生延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
动画之间的jQuery延迟

Possible Duplicate:
jQuery delay between animations

我创建了两个函数:一个将一个对象从A点动画到B点,另一个将一个动画从B点动画到C.我想在这两个函数之间设置一个时间延迟. 有人可以告诉我如何实现这一目标.我失败的尝试是:

I have created two functions: One that animates an object from Point A to Point B, and the second, that animates from Point B to C. I would like to have a time delay betweeen the 2 functions. Can someone please tell me how to achieve this. My unsuccessful attempt was:

movt_1().delay(5000).movt_2();

此外,我想在第一个动画开始之前的一开始就有一个延迟

Also, I would like to have a delay right at the beginning BEFORE the first animation runs

谢谢!

推荐答案

function movt_1 ()
{
  //your code here
  setTimeout (movt_2, 5000);
}

function movt_2 ()
{
  //your code here
}

setTimeout (movt_1, 5000);

将第一个参数更改为正确"方式.

Changed the first parameter to the "proper" way.

这篇关于在功能运行之间产生延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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