Twitter Bootstrap:模态弹出窗口不会褪色

时间:2012-05-01 22:55:54

标签: twitter-bootstrap modal-dialog fade

我使用twitter bootstrap模式插件获得以下标记:

    <div class="tabbable">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#tabPeople" data-toggle="tab">People</a></li>
            <li><a href="#tabRoles" data-toggle="tab">Roles</a></li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane active fade in" id="tabPeople">
                <a data-toggle="modal" href="#modalEditPerson1">Name</a>
                <div class="modal hide fade in" id="modalEditPerson1">
                    <div class="modal-header">
                        <button class="close" data-dismiss="modal">
                            ×</button>
                        <h3>
                            Name</h3>
                    </div>
                    <div class="modal-body">
                        <p>
                            One fine body…</p>
                    </div>
                    <div class="modal-footer">
                        <a href="#" class="btn" data-dismiss="modal">Close</a> <a href="#" class="btn btn-primary">
                            Save changes</a>
                    </div>
                </div>                   
            </div>
            <div class="tab-pane fade" id="tabRoles">
                <p>
                    Role stuff here.</p>
            </div>
        </div>
    </div>

这会显示一个模态,但不会像在此页面上的演示中那样消失:http://twitter.github.com/bootstrap/javascript.html#modals

更新 我已经意识到问题是它嵌套在一个.tabbable div中,它也使用.fade 我已经更新了上面的html。

2 个答案:

答案 0 :(得分:11)

你可能忘了为动画添加javascript

<script src="assets/js/bootstrap-transition.js"></script>
<script src="assets/js/bootstrap-modal.js"></script>

需要首先包含transitions.js!

答案 1 :(得分:-2)

首先将你的模态弹出文件放在body标签之外。之后评论或删除bootstrap.css中类modal-backdrop的display属性,如下所示

modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  background-color: #000;
  /*display:none;*/

now write some jquery as i have mentioned below:

$("#Yourid").click(function() {

  $('.modal-backdrop fade in').attr("display", "block");
});