【发布时间】:2015-03-30 03:36:53
【问题描述】:
我想在 Twitter Bootstrap 中处理两个不同的模式对话框。
所以我的想法是我只需复制模态对话框 HTML 并使用 data-toggle="modal2" 创建一个新按钮 (BTN2)。单击新按钮 (BTN2),应该会显示第二个模式对话框,而不是第一个。
我通过单击 BTN2 进行了尝试,但没有显示任何对话框。但是,在现有按钮 (BTN1) 上,两个对话框都会显示。
这是当前的模态对话框。是的,它基于 bootstrap.com 提供的示例,因此是 bs-example-modal-lg 类。
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="PodcastModal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<ul class="nav nav-tabs" role="tablist" id="list"></ul>
</div>
<div class="modal-body">
<div id="items"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Done!</button>
</div>
</div>
</div>
</div>
这是调用模态对话框的按钮。
<div class="btn-group">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">
<span class="glyphicon glyphicon-plus"></span> <span class="hidden-xs">Add</span>List</button>
</div>
【问题讨论】:
-
这个问题与那个无关。
-
你有没有考虑过只有一个模态的方法?:getbootstrap.com/javascript/#modals-related-target
标签: javascript html twitter-bootstrap