shown.bs.modal fires multiple times when you close and reopen modal

后端 未结 7 479
囚心锁ツ
囚心锁ツ 2020-12-29 08:07

I have made a fiddle illustrating the issue I am facing at the moment. So every time I close and open a modal, shown.bs.modal also fires multiple times. In this

相关标签:
7条回答
  • 2020-12-29 08:55

    You can try as following: (Bootstrap v3.3.6)

    $('#dialog')
    .modal({show: false})
    .on('hide.bs.modal', function () {
        //..................
    }).on('shown.bs.modal', function (event) {
        //..................                  
    }).on('hidden.bs.modal', function () {
        $("#dialog").off();
    });
    $('#dialog').modal('show');
    
    0 讨论(0)
提交回复
热议问题