Bootstrap模态弹出窗口隐藏或关闭

时间:2015-12-11 21:00:54

标签: html css twitter-bootstrap bootstrap-modal

我的模态引导程序中存在问题。 我尝试创建一个模态并在模态内创建一个模态弹出窗口。 结果是打开的,不仅在我点击按钮时打开。

<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 个答案:

答案 0 :(得分:0)

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