Twitter Bootstrap: Modal popup won't fade

一世执手 提交于 2019-12-02 04:02:02

问题


I have the following markup using a twitter bootstrap modal plugin:

    <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>

This brings up a modal, but doesn't fade it as in the demo on this page: http://twitter.github.com/bootstrap/javascript.html#modals

UPDATE I have realised that the issue is that it is nested within a .tabbable div which also uses .fade I've updated the html above.


回答1:


you probably forgot to include the javascript for the animations

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

the transitions.js needs to get included first!




回答2:


First place your modal pop outside the body tag.After that comment or remove display property from class modal-backdrop in bootstrap.css as i have done below

.

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");
});


来源:https://stackoverflow.com/questions/10405531/twitter-bootstrap-modal-popup-wont-fade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!