Twitter bootstrap 从隐藏块引导模式

Twitter bootstrap 从隐藏块引导模式,twitter-bootstrap,modal-dialog,Twitter Bootstrap,Modal Dialog,我有一些类似bootrstrap的代码示例: <!-- Button trigger modal --> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> Launch demo modal </button> <div class="hider"> <!-- Modal --> <

我有一些类似bootrstrap的代码示例:

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

<div class="hider">
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
</div>
但是我的模型不起作用。模态必须在块中显示:无; 请帮帮我

UPD增加了演示


UPD2我的模式位于隐藏在移动版本中的块中,我无法从隐藏中删除display:none

好的,正如您所说,您可以从“display:none
然后将模式html放在
hider`类之外

例如:您可以将modal的HTML放在正文的开头。它会在调用时工作

演示


注意:我检查过你是个小提琴手。它使用的是非常旧的引导版本

您只需在显示/隐藏事件时显示/隐藏块即可:

$('#myModal').on('show.bs.modal', function() {
 $(this).parent().show();
})
$('#myModal').on('hide.bs.modal', function() {
 $(this).parent().hide();
})
叉形小提琴->


顺便说一句:你意识到你在小提琴中使用的是Bootstrap 2.3.1(!!???)吗?

没有收到你的问题,然后我单击仅显示背景的启动演示模式,但模式窗口不可见。请阅读我的评论。我做不到,我的块必须隐藏。这有帮助吗?
$('#myModal').on('show.bs.modal', function() {
 $(this).parent().show();
})
$('#myModal').on('hide.bs.modal', function() {
 $(this).parent().hide();
})