13

Is it possible to close a twitter bootbox after 10 seconds?! i open it like this:

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

    }
}); 
davidOhara
  • 1,008
  • 5
  • 17
  • 39

2 Answers2

27

This code will close the open bootbox automatically after 10 seconds.

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

See the documentation here

Scott
  • 21,211
  • 8
  • 65
  • 72
  • 1
    Wow, that is working perfect! Another Question, can i show the seconds remaining in the bootbox?! – davidOhara Jul 20 '13 at 12:33
  • 2
    @chrizstone Glad it helped. You would need to post that as another question, it's slightly more involved. If this has answered the original question don't forget to select it as the answer. Thanks – Scott Jul 20 '13 at 12:35
4

I just committed a patch that would add this functionality to bootbox.

It is available on the link below.

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.dialog({
    message  : "Your operation completed successfully.",
    timeOut : 2000
});

Cheers.

bhagyas
  • 3,050
  • 1
  • 23
  • 21