Search code examples
javascriptcssbootstrap-modal

Closing Bootstrap modal will resize my page


I'm trying to make a bootstrap modal for my page. But whenever I try to close that modal, that modal will resize my entire page.

here is the gif that I took from my page : https://ibb.co/iN5Bep

also, I use this: http://www.java2s.com/Tutorials/HTML_CSS/Bootstrap_Example/Dialog/Launch_a_modal_dialog_from_a_link_button.htm as my modal

I'm quite new with javascript and bootstrap, and I'm not really sure what to do to fix this. please help

Edit : i use :

<a href="#myModal1" data-toggle="modal">+Add Data</a>

to open :

  <div class="bs-example">
    <div id="myModal1" class="modal fade">
      <div class="modal-dialog" style="width:70%!important;">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"
              aria-hidden="true">&times;</button>
            <h4 class="modal-title">Add Credentials Data</h4>
          </div>
          <div class="modal-body">
            //contenthere
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
          </div>
        </div>
      </div>
    </div>
  </div>

to close it i use :

 <button type="button" class="close" data-dismiss="modal"
                  aria-hidden="true">&times;</button>

or

 <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>

Solution

  • i solved it by making the body tag position fixed and adding a new div below it.

    all thanks to @Ryan Brackett answer from : Fixed position div scrollable post