本文介绍了jQuery delay()或setTimeout()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请你帮助我...我需要在新标签页(或窗口)中打开一个链接,但只有在执行了一些函数之后。我尝试了一切,纯Javascript,jQuery,什么都行不通。
如果提供的解决方案是delay()或setTimeout(),对我来说无关紧要。
我认为延迟()的问题是它只适用于fx队列中的函数,我尝试了一些东西,但是无法让它工作。
Please if you could help me…i need to open a link in new tab(or window), but only after executing a few functions.I tried everything, pure Javascript, jQuery, nothing works.It doesn't matter to me if the solution provided is with delay() or with setTimeout().I think that the problem with delay() is that it only works with functions in fx queue, i tried something, but just can't get it to work.
以下是代码:
$(function(){
$("#playNowLink").click(function() {
$(‘#header’).effect("fold", { size: "50%" }, 1000);
$(‘#showVideo’).delay(1100).fadeIn(‘slow’);
// Here i would like to call ‘playNow.html’,
//but only after 7-8 seconds
});
提前致谢
推荐答案
setTimeout(function(){
//whatever the heck you want do to:
//open window:
window.open('new_window_url');
//change location?
window.location = "new_location_url";
}, 7500); //7.5 seconds
这篇关于jQuery delay()或setTimeout()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!