twitter-bootstrap x 秒后关闭 Twitter Bootbox
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17762247/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Close Twitter Bootbox after x seconds
提问by davidOhara
Is it possible to close a twitter bootbox after 10 seconds?! i open it like this:
是否可以在 10 秒后关闭 Twitter 引导箱?!我是这样打开的:
bootbox.confirm("{{$steps[0]}}","accept","decline" ,function(result) {
if (result) {
}
});
回答by Scott
This code will close the open bootbox automatically after 10 seconds.
此代码将在 10 秒后自动关闭打开的引导箱。
window.setTimeout(function(){
bootbox.hideAll();
}, 10000); // 10 seconds expressed in milliseconds
See the documentation here
回答by bhagyas
I just committed a patch that would add this functionality to bootbox.
我刚刚提交了一个补丁,可以将此功能添加到 bootbox。
It is available on the link below.
它可以在下面的链接上找到。
https://github.com/bhagyas/bootbox/commit/72cd1ada43d3aa74f0dcfb10d66219fe208063af
https://github.com/bhagyas/bootbox/commit/72cd1ada43d3aa74f0dcfb10d66219fe208063af
After adding this patch to your bootbox.js, you could set an additional timeOut option in your options for bootbox.
将此补丁添加到 bootbox.js 后,您可以在 bootbox 的选项中设置额外的超时选项。
bootbox.dialog({
message : "Your operation completed successfully.",
timeOut : 2000
});
Cheers.
干杯。

