无法从引导 PHP 中的另一个模态调用模态
Unable to call a modal from another modal in Bootstrap PHP
我有一个 2 个引导模式,目前不起作用。当我单击我的图像时,整个屏幕只是变灰,没有显示模态对话框。我想从第一个模态窗口调用另一个模态窗口。
意思是从第一个模态窗口#test
,我需要调用#myModal2
。现在的问题是,一旦我添加了第二个模态,第一个模态就根本没有出现。请帮忙吗?
if ($result = mysqli_query($connection,$sql)){
while ($row=mysqli_fetch_assoc($result)){
$formatted_name = str_replace(" ", "", $row['fname']);
echo '<a href="#test" data-toggle="modal"> <img src='.$row['fpics']." alt = '' class='img-thumbnail height='200px' width='200px' ></img></a>";
?>
<div id="test" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
<p>One modal body…</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<a href="#myModal2" role="button" class="btn" data-toggle="modal">Launch other modal</a>
</div>
</div>
<div id="myModal2" class="modal hide fade" data-backdrop-limit="1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal 2 header</h3>
</div>
<div class="modal-body">
<p>Two modal body…</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
<?php
}//while bracket
}//if bracket
最好的方法是使用此插件扩展引导模式
https://github.com/jschr/bootstrap-modal/
因为我没有在核心引导程序中调用模态内部的modla,所以我必须扩展它。
这是如何使用它的示例
<button class="demo btn btn-primary btn-lg" data-toggle="modal" href="#responsive1">View Demo</button>
<div id="responsive1" class="modal fade" tabindex="-1" data-width="760" style="display: none;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Responsive</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<h4>Modal 1</h4>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-default">Close</button>
<button type="button" data-toggle="modal" href="#responsive2" class="btn btn-danger">Launch another modal</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
<div id="responsive2" class="modal fade" tabindex="-1" data-width="760" style="display: none;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Responsive</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<h4>Modal 2</h4>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-default">Close</button>
</div>
</div>
这是工作小提琴http://jsfiddle.net/52VtD/9123/
相关文章:
- bootstrap消除模态并显示另一个模态
- 包括来自另一个页面的Boostrap模态;t验证表单
- Angularjs - 观察模态窗口从另一个控制器关闭
- 将数据从一个模态发送到另一个模态
- 基础 - 在关闭另一个模态时打开另一个模态
- 从另一个 JavaScript 函数中调用 jQuery(模态弹出窗口)函数
- 角度:在另一个模态指令中加载的谷歌地图指令保持空白
- 当按下当前模态上的按钮时,如何触发另一个模态
- 无法从引导 PHP 中的另一个模态调用模态
- 在第一个模态中打开另一个模态时,启动模态问题
- 从另一个页面获取Bootstrap's模态内容
- 如何关闭另一个模态对话框
- 选中单选后调用另一个模态
- 为引导模态编写一个回调函数
- Jquery + Bootstrap Modal,打开另一个模态内部…为什么
- 如何在另一个html文件中包含html片段(用于引导模态)
- 如何在一个模态中传递文本框的值给另一个文本框
- 引导3 -从另一个模态打开模态
- 如何在引导程序中在一页上显示两个模态,一个左对齐,另一个右对齐
- 从另一个模态打开一个模态