Bootstrap Modal Backdrop Remaining

前端 未结 24 2053
被撕碎了的回忆
被撕碎了的回忆 2020-12-23 08:55

I am showing a Bootstrap modal window for loading when performing AJAX calls. I broadcast a \"progress.init\" event when the loading modal should show and a \"progress.finis

24条回答
  •  暖寄归人
    2020-12-23 09:45

    This is what worked for me -

    When the hidden.bs.modal event is fired, jQuery's .remove() function can remove the element that has .modal-backdrop class. So each time the modal is closed, the modal-backdrop will be removed.

    //setting callback function for 'hidden.bs.modal' event
    $('#modal').on('hidden.bs.modal', function(){
      //remove the backdrop
      $('.modal-backdrop').remove();
    })
    

    Good Luck.

提交回复
热议问题