Javascript 页面中有多个引导模式窗口
我需要多个引导3模式在一个页面。我改变了每个模式框的ID,但这起作用了 HTML:Javascript 页面中有多个引导模式窗口,javascript,jquery,html,twitter-bootstrap,Javascript,Jquery,Html,Twitter Bootstrap,我需要多个引导3模式在一个页面。我改变了每个模式框的ID,但这起作用了 HTML: <span class="filesicon"><a data-target="#myModal-1" href="#" data-toggle="modal" type="button"><i class="mce-ico mce-i-browse"></i></a></span> <span class="filesicon">
<span class="filesicon"><a data-target="#myModal-1" href="#" data-toggle="modal" type="button"><i class="mce-ico mce-i-browse"></i></a></span>
<span class="filesicon"><a data-target="#myModal-2" href="#" data-toggle="modal" type="button"><i class="mce-ico mce-i-browse"></i></a></span>
<div class="modal fade" id="myModal-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body" style="padding:0px; margin:0px width: 560px;">
<iframe width="560" height="400" src="" frameborder="0" style="overflow: scroll; overflow-x: hidden; overflow-y: scroll; "></iframe>
</div>
</div>
</div>
</div>
<div class="modal fade" id="myModal-2">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body" style="padding:0px; margin:0px width: 560px;">
<iframe width="560" height="400" src="" frameborder="0" style="overflow: scroll; overflow-x: hidden; overflow-y: scroll; "></iframe>
</div>
</div>
</div>
</div>
&时代;
情态标题
&时代;
情态标题
我的方式是真的吗?如果没有,请告诉我更好的方法。这是在一个页面上放置多个情态动词的正确方法。根本无法避免 您可以以相同的方式调用每个模式,只需更改
数据目标
,以反映要显示的所需模式
<a href="#" class="list-group-item" id="myModal-1-link" data-toggle="modal" data-target="#myModal-1">Modal 1</a>
<a href="#" class="list-group-item" id="myModal-2-link" data-toggle="modal" data-target="#myModal-2">Modal 2</a>
除了Bootstrap之外,没有其他方法可以做到这一点,但我确信modals还有其他更简单的选项,尽管我怀疑它们能否如此流畅地使用Bootstrap。如果使用其他插件是一个选项,您是否考虑过bootbox.js 它允许您使用几行javascript而不是庞大的HTML来显示引导模式 示例显示引导模式,要求用户确认某些操作:
bootbox.confirm("Are you sure?", function(result) {
Example.show("Confirm result: "+result);
});
我在中使用了您的代码,似乎工作正常。也许你的代码中还有别的东西把你的情态动词搞乱了
或尝试
$('#myModal-1').modal(选项)
$('#myModal-2').modal(选项)
开始。在类似的情况下,这对我来说是个好办法