How to automatically close the bootstrap modal dialog after a minute

后端 未结 6 1512
青春惊慌失措
青春惊慌失措 2020-12-30 14:23

I am using the bootstrap modal in one of my project. I\'m using the timer functions for automatically showing the bootstrap modal.

If the user doesn\'t close the bo

6条回答
  •  清歌不尽
    2020-12-30 15:06

    Try

    var myModal = $('#myModal').on('shown', function () {
        clearTimeout(myModal.data('hideInteval'))
        var id = setTimeout(function(){
            myModal.modal('hide');
        });
        myModal.data('hideInteval', id);
    })
    

提交回复
热议问题