我有一个 jquery 对话框,我想在用户进入该页面后 30 秒弹出它。
我的对话框代码是:
<script>
$(function() {
$("#dialog).dialog(
{
width: "300",
height: "280",
modal: true,
resizable: false,
closeOnEscape: true ,
open: function(){
jQuery('.ui-widget-overlay, #dialog-survey').bind('click',function(){
jQuery('#dialog').dialog('close');
})
}
});
$(".ui-dialog-titlebar").hide()
$(".survey_link").bind("click", function() {
var now = new Date();
var time = now.getTime();
time += 3600 * 1000;
now.setTime(time);
document.cookie='CLK=YES;expires=' + now.toUTCString() + ';path=/';
});
});
</script>
我看过有关如何在 X 秒后关闭的代码,并尝试使用它使对话框在 x 秒后打开,但没成功。我需要什么?谢谢!
最佳答案
$(document).ready(function(){
setTimeout(function(){
$("#dialog").dialog("open");
}, 30000);
};
关于javascript - 30 秒后显示 Jquery UI 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20003994/