Bootstrap 模态 window 未从内部打开 bootstrap 弹出框
Bootstrap modal window not opening from inside bootstrap popover
当您单击 "MAGIC" 时,会显示一个 bootstrap 弹出窗口,您会在其中看到设置图标。如果您单击该图标,模式 window 应该会打开,就像您单击蓝色按钮 "Launch demo modal" 一样。我该如何解决?有什么问题?
这是我的代码:https://jsfiddle.net/vhsqf65z/
<span data-html='true' data-toggle='popover'
title='<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal"><i class="glyphicon glyphicon-cog"></i></button>'
data-content='<b>content</b>'> MAGIC </span>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-
dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
谢谢
编辑:
添加了显示弹出窗口和设置按钮的图像。
enter image description here
我修改了您的代码,删除了处理 inserted.bs.popover
事件:
https://jsfiddle.net/05nzfcak/
我测试过它可以工作(如果我理解正确的话)
当您单击 "MAGIC" 时,会显示一个 bootstrap 弹出窗口,您会在其中看到设置图标。如果您单击该图标,模式 window 应该会打开,就像您单击蓝色按钮 "Launch demo modal" 一样。我该如何解决?有什么问题?
这是我的代码:https://jsfiddle.net/vhsqf65z/
<span data-html='true' data-toggle='popover'
title='<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal"><i class="glyphicon glyphicon-cog"></i></button>'
data-content='<b>content</b>'> MAGIC </span>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-
dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
谢谢
编辑: 添加了显示弹出窗口和设置按钮的图像。 enter image description here
我修改了您的代码,删除了处理 inserted.bs.popover
事件:
https://jsfiddle.net/05nzfcak/
我测试过它可以工作(如果我理解正确的话)