我已将此代码内联在文档中
if($.cookie('form_seen') == null) {
$("#dialog_form").dialog("open");
}
Run Code Online (Sandbox Code Playgroud)
我知道如何在JQuery 1.5.x中使用如何延迟自动打开模态对话框窗口的 setTimeout ?所以不需要发布一个setTimeout示例.
我想知道我的个人教育,如果我想使用.delay而不是setTimeout,那么正确的语法是什么
if($.cookie('form_seen') == null) {
$("#dialog_form").delay(5000).dialog("open");
}
Run Code Online (Sandbox Code Playgroud)
或类似的
在这种情况下,我不得不明白我会得到什么,因为我必须包装$("#dialog_form").dialog("open");setTimeout调用的函数,所以不需要闭包或找回$(this),但在其他情况下我可以想象链接更聪明.评论利弊是非常受欢迎的
if($.cookie('form_seen') == null) {
$("#dialog_form")
.delay(5000)
.queue(function(next){
$(this).dialog("open");
next(); // take this function out of queue a.k.a dequeue a.k.a notify done
// so the next function on the queue continues execution...
})
}
Run Code Online (Sandbox Code Playgroud)
要么
if($.cookie('form_seen') == null) {
$("#dialog_form")
.delay(5000)
.queue(function(){
$(this)
.dialog("open")
.dequeue(); // take this function out of queue a.k.a dequeue a.k.a notify done
// so the next function on the queue continues execution...
})
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6531 次 |
| 最近记录: |