Bootstrap Modal Backdrop Remaining

前端 未结 24 2054
被撕碎了的回忆
被撕碎了的回忆 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:51

    The best and simple approach is by using the data-dismiss attribute. Basically the data-dismiss attribute will dismiss the modal and you won't see the backdrop remaining.

    How to use data-dismiss attribute

    All you need to do is adding the following at the place where you want to close your modal:

    data-dismiss="modal" 
    

    For example, I have a button and when someone clicks the button it will close the modal.

    
    

    You can also handle the JavaScript function on onClick and it will close the modal and also run the JavaScript function.

    This is the best approach to do using the data-dismiss attribute.

提交回复
热议问题