【问题标题】:Close Twitter Bootbox after x secondsx 秒后关闭 Twitter Bootbox
【发布时间】:2013-07-20 12:27:04
【问题描述】:

是否可以在 10 秒后关闭 Twitter 引导框?!我这样打开它:

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

    }
}); 

【问题讨论】:

    标签: javascript jquery twitter-bootstrap bootbox


    【解决方案1】:

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

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

    见documentation here

    【讨论】:

    • 哇,效果很好!另一个问题,我可以显示引导箱中剩余的秒数吗?!
    • @chrizstone 很高兴它有帮助。您需要将其作为另一个问题发布,它的涉及程度略高。如果这已经回答了原始问题,请不要忘记选择它作为答案。谢谢
    【解决方案2】:

    我刚刚提交了一个可以将此功能添加到 bootbox 的补丁。

    它可以在下面的链接上找到。

    https://github.com/bhagyas/bootbox/commit/72cd1ada43d3aa74f0dcfb10d66219fe208063af

    将此补丁添加到您的 bootbox.js 后,您可以在 bootbox 选项中设置额外的 timeOut 选项。

    bootbox.dialog({
        message  : "Your operation completed successfully.",
        timeOut : 2000
    });
    

    干杯。

    【讨论】:

      猜你喜欢
      • 2022-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多