Bootstrap模态主体内容未隐藏 [英] Bootstrap Modal Body Content Not Hiding
本文介绍了Bootstrap模态主体内容未隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此模式可以完美运行:
<!-- Modal -->
<div class="modal fade" id="company-about" tabindex="-1" role="dialog" aria-labelledby="company-about-label" aria-hidden="true">
<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" id="company-about-label">Company Name</h4>
</div>
<div class="modal-body">
<p>Company bio here...</p>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
下面的此模态立即遵循上述模态,但表是显示而不是隐藏.单击时,表内容为空白.如果我删除表格数据并替换为文本,它将按预期工作:
This Modal below follows the above Modal immediately, but the Table is showing, rather than being hidden. On click, the Table content is blank. If I delete the Table data and replace with a text, it works as expected:
<!-- Modal -->
<div class="modal fade" id="fee-details" tabindex="-1" role="dialog" aria-labelledby="fee-details-label" aria-hidden="true">
<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" id="fee-details-label">Fees - What this loan will cost you to close</h4>
</div>
<div class="modal-body">
<table class="table table-condensed">
<thead>
<tr>
<th>Header1</th>
<th>Header2</th>
<th>Header3</th>
</tr>
</thead>
<tbody>
<tr>
<td>data1</td>
<td>data2</td>
<td>data3</td>
</tr>
</tbody>
</table>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
推荐答案
您必须将模式的代码移到表外.我通常将模式代码放在</body>页面的最底部.标签.
You have to move your code for the modal outside of the table. I typically put modal code at the very bottom of the page before the </body> tag.
请参阅工作提琴: http://jsfiddle.net/mty3g/19/
<body>
<div class="container">
<table class="table table-width-condensed spacer-top">
<tr>
<td><a href="#fee-details" data-toggle="modal">$800</a></td>
<td><a href="#company-about" data-toggle="modal">Company Name</a></td>
</tr>
</table>
</div> <!-- /container -->
<!-- Modal -->
<div class="modal fade" id="company-about" tabindex="-1" role="dialog" aria-labelledby="company-about-label" aria-hidden="true">
<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" id="company-about-label">Company Name</h4>
</div>
<div class="modal-body">
<p>Company summary...</p>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div class="modal fade" id="fee-details" tabindex="-1" role="dialog" aria-labelledby="fee-details-label" aria-hidden="true">
<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" id="fee-details-label">Fee Details</h4>
</div>
<div class="modal-body">
<table class="table table-condensed">
<thead>
<tr>
<th>Header1</th>
<th>Header2</th>
</tr>
</thead>
<tbody>
<tr>
<td>data1</td>
<td>data2</td>
</tr>
</tbody>
</table>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.js"></script>
</body>
这篇关于Bootstrap模态主体内容未隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文