Bootstrap modal appearing under background

前端 未结 30 986
离开以前
离开以前 2020-11-22 17:09

I have used the code for my modal straight from the Bootstrap example, and have included only the bootstrap.js (and not bootstrap-modal.js). However, my modal is appearing u

30条回答
  •  感情败类
    2020-11-22 17:16

    The problem has to do with the positioning of the parent containers. You can easily "move" your modal out from these containers before displaying it. Here's how to do it if you were showing your modal using js:

    $('#myModal').appendTo("body").modal('show');
    

    Or, if you launch modal using buttons, drop the .modal('show'); and just do:

    $('#myModal').appendTo("body") 
    

    This will keep all normal functionality, allowing you to show the modal using a button.

提交回复
热议问题