问题描述
以下对话框在点击时很好地工作:
< a href =#onclick =jQuery '#dialogX')。dialog('open');
return false><? echo __(Under Construction)?>< / a>
位于html底部的JavaScript触发动作:
jQuery(#dialogX)对话框({bgiframe:true,autoOpen:false,modal:true});
现在,我想要的是在对话框弹出2秒后立即显示)。我看到选项autoOpen,当将值设置为2000而不是false时,该helas dit不起作用:它立即打开。我失踪了什么
非常感谢您的提示,祝您周末愉快。
您可以使用
var timeoutID = window.setTimeout(func,delay,[param1,param2,...] );
var timeoutID = window.setTimeout(code,delay);
从 它在指定延迟后执行代码段或函数。 / p>
所以
setTimeout(function(){showDialog()}, 2000年);
应该可以解决您的问题。
看看 .delay(n)
方法。
$ b $($)$ $ $ $ $ $ $'$'$'
The following dialog box works nicely when clicked upon:
<a href="#" onclick="jQuery('#dialogX').dialog('open');
return false"><? echo __("Under Construction")?></a>
The javascript sitting at the bottom of the html triggers the action:
jQuery("#dialogX").dialog({bgiframe: true, autoOpen: false, modal: true});
Now, what I would wish, is to have the dialog popup after say 2 seconds (insterad of immediately). I saw the option autoOpen and when setting the value to 2000 instead of false, that helas dit not work: it opens immediately. What am I missing?
Thanks very much for your hints and wish you a nice weekend.
You can use
var timeoutID = window.setTimeout(func, delay, [param1, param2, ...]);
var timeoutID = window.setTimeout(code, delay);
from https://developer.mozilla.org/en/DOM/window.setTimeout It executes a code snippet or a function after specified delay.
So
setTimeout(function(){ showDialog() }, 2000);
should solve your problem.
Also have a look at the .delay( n )
method. http://api.jquery.com/delay/
$('.notice').fadeIn().delay(2000).fadeOut('slow');
这篇关于如何在JQuery 1.5.x中延迟自动打开Modal对话框窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!