Como fechar automaticamente a caixa de diálogo modal de bootstrap após um minuto

Eu estou usando o modal bootstrap em um dos meus projetos. Estou usando as funções do timer para mostrar automaticamente o modal de bootstrap.

Se o usuário não fechar o modal de bootstrap por um minuto. Então, ele automaticamente precisa fechar o modal de bootstrap.

Como definir o temporizador para fechar o modal bootstrap automaticamente?

Por favor, me ajude a resolver este problema.

Desde já, obrigado :)



    var mins;
            var secs;
            function cd() {
                mins = 1 * m("");
                secs = 0 + s(":"); // change seconds here (always add an additional second to your total)
                console.log(mins);
                console.log(secs);
                redo();
            }
            function m(obj) {
                for(var i = 0; i ";
                if(mins :";
                disp += "";
                if(secs ";
                return(disp);
            }
            function redo() {
                secs--;
                if(secs == -1) {
                    secs = 59;
                    mins--;
                }
                $('#myModal').on('shown', function() {
                    // remove previous timeouts if it's opened more than once.
                    clearTimeout(myModalTimeout);

                    // hide it after a minute
                    myModalTimeout = setTimeout(function() {
                        $('#myModal').modal('hide');
                    }, 5000);
                });
                document.getElementById('timer_container').innerHTML = dis(mins,secs); 
                if((mins == 1) && (secs == 45)) {
                    $("#myModal").modal('show');
                    $('#myModal').on('shown', function() {
                        // remove previous timeouts if it's opened more than once.
                        clearTimeout(myModalTimeout);

                        // hide it after a minute
                        myModalTimeout = setTimeout(function() {
                            $('#myModal').modal('hide');
                        }, 5000);
                    });
                    $('.timer-inc').click(function(){
                        $("#myModal").modal('hide');
                        href="includes/setSessionTime.php";
                        $.ajax({ 
                            type: "POST",
                            //data : {cat:"hai"},
                            cache: false,
                            url: href,   
                            success: function(data){
                                console.log(data);
                               $("#results").html(data);              
                            } 
                        });
                    });

                    $('.timer-close').click(function(){
                        $("#myModal").modal('hide');
                        href="includes/clearcart.php";
                        $.ajax({ 
                            type: "POST",
                            //data : {cat:"hai"},
                            cache: false,
                            url: href,   
                            success: function(data){
                                console.log(data);
                               $("#results").html(data);              
                            } 
                        });
                    });

                    $('#myModal').on('hidden', function () {
                        href="includes/clearcart.php";
                        $.ajax({ 
                            type: "POST",
                            //data : {cat:"hai"},
                            cache: false,
                            url: href,   
                            success: function(data){
                                console.log(data);
                               $("#results").html(data);              
                            } 
                        });    
                    });
                }
                else if((mins == 0) && (secs == 00)){
                    $("#myModal").modal('hide');
                    href="includes/clearcart.php";
                        $.ajax({ 
                            type: "POST",
                            //data : {cat:"hai"},
                            cache: false,
                            url: href,   
                            success: function(data){
                                console.log(data);
                               $("#results").html(data);              
                            } 
                        });
                }
                else {
                    cd = setTimeout("redo()",1000);
                }
            }
            function init() {
                cd();
            }

questionAnswers(5)

yourAnswerToTheQuestion