当它调用时,Bootstrap模态隐藏在模态后面

时间:2015-04-30 21:01:42

标签: twitter-bootstrap modal-dialog

我正在使用Bootstrap模态但是当我从当前模态调用第二个模态时它隐藏在第一个模态后面。

这是我的代码和jsfiddle的链接

HTML

<div id="dialog1" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title">Modal Dialog 1</h4>
      </div>
      <div class="modal-body">This is the first modal dialog</div>
      <div class="modal-footer">
        <button type="button" id="dialog-ok" class="btn btn-default">Show dialog 2</button>          
        <button type="button" id="dialog-close" class="btn btn-default" data-dismiss="modal">Close</button>          
      </div>
    </div>
  </div>
</div>

<div id="dialog2" class="modal">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title">Modal Dialog 2</h4>
      </div>
      <div class="modal-body">This is the second modal dialog</div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>          
      </div>
    </div>
  </div>
</div>

的Javascript

$("#dialog1").modal("show");

    $("#dialog-ok").on("click", function() {
        showDialog2();
    });

jsfiddle

0 个答案:

没有答案