我的模态 Bootstrap 有问题。 我尝试创建一个模态,并在模态中创建一个模态弹出框。 结果是它是打开的,而不是仅在我单击按钮时打开。
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<a href="#" role="button" class="btn btn-default popover-test" title="" data-content="And here's some amazing content. It's very engaging. right?" data-original-title="A Title" aria-describedby="popover64665">button</a>
<div class="popover fade right in" role="tooltip" id="popover64665" style="top: 0px; left: 112px; display: block;">
<div class="arrow" style="top: 50%;"></div>
<h3 class="popover-title">A Title</h3>
<div class="popover-content">And here's some amazing content. It's very engaging. right?</div>
</div>
</div>
</div>
我的 jsfidle
最佳答案
1) 你需要包含 jQuery.js 和 bootstrap.js + bootstrap.css
2) 如果没有 JS 它就无法工作,所以你需要设置例如 script.js
3) 在 HTML 中设置 <script src="script.js"></script>
4) 在script.js
类型:
$('#myModal').on('shown.bs.modal', function () {
$('#myInput').focus();
});
希望对您有所帮助... CODEPEN.io
关于html - Bootstrap 模态弹出窗口隐藏或关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34232483/