Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Modal visible on document load

I have a Bootstrap Model working fine, except that it is visible when the document loads and I can't work out how to make the initial state invisible?

<a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a>


<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Modal header</h3>
  </div>
  <div class="modal-body">
    <p>One fine body…</p>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
    <button class="btn btn-primary">Save changes</button>
  </div>
</div>
like image 442
Myles McDonnell Avatar asked Jun 18 '26 23:06

Myles McDonnell


2 Answers

Following documentation, add hide class to the modal.

<div class="modal hide fade">
    ...
</div>
like image 146
albertedevigo Avatar answered Jun 23 '26 12:06

albertedevigo


Turns out simply adding style="display: none" to the modal outer div did the trick.

like image 35
Myles McDonnell Avatar answered Jun 23 '26 13:06

Myles McDonnell