twitter-bootstrap 打开 Bootstrap 模式后无法单击任何内容

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34328357/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 23:26:39  来源:igfitidea点击:

Can't click anything after i open my Bootstrap modal

twitter-bootstrapbootstrap-modal

提问by Franco Papalardo

sorry for the basic question, I'm working on MVC ASP.NET and I'm trying to add a bootstrap modal in my navbar, I run the code, i can see the button i can touch on it, but after it open, the screen is unclickable i have to f5 to click anywhere again, it's the first time i use modals from bootstrap, and search all around google if I have to write some JavaScript code, but everywhere says that you just need jquery , bootstrap.js and .css and nothing else. If I'm missing something just let me know. Thanks, Here is my code.

对于基本问题,我正在研究 MVC ASP.NET,我正在尝试在导航栏中添加引导模式,我运行代码,我可以看到我可以触摸的按钮,但是在它打开后,屏幕无法点击我必须按 f5 再次点击任何地方,这是我第一次使用 bootstrap 中的模态,如果我必须编写一些 JavaScript 代码并在谷歌周围搜索,但到处都说你只需要 jquery、bootstrap.js 和.css 而不是别的。如果我遗漏了什么,请告诉我。谢谢,这是我的代码。

PD: I have a carousel already working from bootstrap

PD:我有一个已经在引导程序中工作的轮播

@if (Session["usuario"] == null)
            {
                <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
                    Ingresar
                </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-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" id="myModalLabel">Iniciar Sesión</h4>
                            </div>
                            <div class="modal-body">
                                <form method="post" action="@Url.Action("DoLogin","Usuario")">
                                        <span class="alert-danger">@ViewBag.NoUser</span>
                                        <label for="NombreDeUsuario" class="sr-only">Nombre de Usuario</label>
                                        <input type="text" id="NombreDeUsuario" name="NombreDeUsuario" class="form-control" placeholder="Ingresa tu Usuario" required="" autofocus="" />
                                        <br />

                                        <label for="Contrasena" class="sr-only">Contrase?a</label>
                                        <input type="password" id="Contrasena" name="Contrasena" class="form-control" placeholder="Ingresa tu Contrase?a" required="" />
                                        <br />
                                        <button class="btn btn-lg btn-primary btn-block" type="submit">Ingresar</button>
                                 </form>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            </div>
                        </div>
                    </div>
                </div>
            }

Here is a screenshot of the problem enter image description here

这是问题的截图 在此处输入图片说明

回答by Daniel C

.modal-backdrop {
  z-index: -1;
}