javascript函数之间的jquery延迟 [英] jquery delay between javascript functions

查看:82
本文介绍了javascript函数之间的jquery延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有乘法函数,其参数简化为:

I have multiply functions with parameters simplified as:

    function f1(p1,p2){
        alert('Function one is P1:'+p1+' P2:'+p2);        
    }
    function f2(p1,p2){
        alert('Function two is P1:'+p1+' P2:'+p2);
    }

我需要解雇这些是之间有延迟的序列.但是,我发现jQuery不喜欢带有参数的运行函数.我已经尝试过.click函数.

I need to fire these is a sequence with a delay between. I have however found that jQuery dislikes running functions with parameters. I have tried the .click function.

$.delay(1000).click(f1('One',false)).delay(1000).click(f2('One',false));

但是延迟会导致点击功能不起作用...

But the delay makes the click functions not work...

推荐答案

我只会使用一个简单的超时时间:

I would just use a simple timeout:

f1("one", false);
setTimeout(function() { f2("one", false); }, 1000);

这篇关于javascript函数之间的jquery延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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