1

相关链接 1) Bootstrap modal 出现在后台

带背景淡入的引导模式

Twitter Bootstrap - 为什么我的模态与背景一样褪色?

错误 http://jsfiddle.net/jononomo/7z8RZ/7/

图片

在此处输入图像描述

CSS/JS

     <script src="~/Scripts/bootstrap.min.js"></script>
        <script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="~/Scripts/bootstrap.js"></script>

代码

<button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal">Signup</button>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

这是一个 Asp.Net MVC4 应用程序

如果我删除导航栏 cssnavbar navbar-inverse navbar-fixed-top但模态位置仍在左侧,则会删除此淡入淡出错误

所有上述相关链接都定义了相同的问题,但没有一个有助于解决我的问题

4

2 回答 2

1

在你的例子中navbar navbar-fixed-top需要z-index > 1040

于 2013-11-08T07:42:07.630 回答
0

将您的代码更改为此

<!--===================navBar===================-->
<div class="navbar navbar-fixed-top"> 
<a href="#registration_modal" data-toggle="modal">
    Register
</a>
</div>
<!--===================modal====================-->
<div id="registration_modal" class="modal hide fade">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
            <h3>Register An Account</h3>
    </div>

    <div class="modal-body">
        Registration form goes here.
    </div>

    <div class="modal-footer">
        <button class="btn btn-secondary" data-dismiss="modal">Cancel</button>
        <button class="btn btn-primary">Register</button>
    </div>

</div>

演示:http: //jsfiddle.net/7z8RZ/55/

于 2013-11-08T07:41:59.577 回答