Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
544 views
in Technique[技术] by (71.8m points)

javascript - jQuery:等待/延迟1秒而不执行代码(jQuery: Wait/Delay 1 second without executing code)

I can't get the .delay method working in jQuery:(我无法在.delay方法:)

$.delay(3000); // not working $(queue).delay(3000); // not working I'm using a while loop to wait until an uncontrolled changing value is greater than or equal to another and I can't find any way to hault execution for X seconds.(我正在使用while循环来等待一个不受控制的更改值大于或等于另一个并且我找不到任何方法来执行X秒的执行。)   ask by Brian Graham translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can also just delay some operation this way:(您也可以通过这种方式延迟某些操作:)

setTimeout(function (){ // Something you want delayed. }, 5000); // How long do you want the delay to be (in milliseconds)?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...