2013-07-20 76 views
11

是否有可能在10秒后关闭twitter bootbox?我打开它是这样的:关闭微博Bootbox后x秒

bootbox.confirm("{{$steps[0]}}","accept","decline" ,function(result) { 
    if (result) { 

    } 
}); 

回答

20

此代码将在10秒后自动关闭打开的bootbox。

window.setTimeout(function(){ 
    bootbox.hideAll(); 
}, 10000); // 10 seconds expressed in milliseconds 

documentation here

+1

哇,这是工作完美!另一个问题,我可以显示在bootbox剩余的秒数?! – davidOhara

+2

@chrizstone很高兴帮助。您需要将其作为另一个问题发布,这会涉及更多的问题。如果这回答了原始问题,不要忘记选择它作为答案。谢谢 – Scott