【问题标题】:Bootstrap modal popover hide or closeBootstrap 模态弹出框隐藏或关闭
【发布时间】:2015-12-11 21:00:54
【问题描述】:

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

<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

【问题讨论】:

标签: html css twitter-bootstrap bootstrap-modal


【解决方案1】:

1) 你需要包含 jQuery.jsbootstrap.js + bootstrap.css

2) 如果没有 JS,它将无法工作,因此您需要设置例如 script.js

3) 在 HTML &lt;script src="script.js"&gt;&lt;/script&gt;

中设置它

4) 在script.js 中输入:

$('#myModal').on('shown.bs.modal', function () {
  $('#myInput').focus();
});

希望对您有所帮助... CODEPEN.io

【讨论】:

    猜你喜欢
    • 2013-01-05
    • 1970-01-01
    • 1970-01-01
    • 2013-01-09
    • 2018-01-01
    • 1970-01-01
    • 2018-03-19
    • 2011-12-02
    • 2013-12-13
    相关资源
    最近更新 更多