简体   繁体   English

Bootstrap的Modal框-背景不会在显示时淡出

[英]Bootstrap's Modal box - background doesn't fade out on show

I'm currently working on a C# MVC application. 我目前正在使用C#MVC应用程序。 I'm using Twitter's Bootstrap's modal boxes as a 'popup' window. 我正在使用Twitter的Bootstrap的模式框作为“弹出”窗口。 This has worked flawlessly in the past, but for some reason it doesn't right now. 在过去,这种方法可以完美地工作,但是由于某种原因,它现在不可行。 The result I get right now is shown below. 我现在得到的结果如下所示。 Don't mind the blur, I did that. 不要介意模糊,我做到了。

Naturally the background is supposed to get grey, faded out like always, though for some reason it doesn't right now. 自然地,背景应该会像往常一样逐渐变灰,尽管出于某种原因,背景暂时不亮。 I've basically copy pasted the code that works elsewhere and changed the values. 我基本上已经复制粘贴了可在其他地方使用的代码并更改了值。 I double and triple checked to make sure I didn't make a mistake somewhere, but I honestly can't see it. 我仔细检查了两次,以确保我没有在某个地方犯错,但老实说我看不到它。

忙碌的猫

I've pasted the relevant code below. 我在下面粘贴了相关代码。 JQuery gets loaded in the layout file. jQuery被加载到布局文件中。 This is a partial view for the record 这是记录的局部视图

    <button id="btnAddNewSecureFolder" onclick="openTheCreateWindow()" data-toggle="modal" data-target="#modal-new-secFolder" class="btn btn-md btn-default giveMeSomeSpace leaveMeAlone">Add a secure folder</button>

    @*<button onclick="openTheCreateWindow()" class="btn btn-md btn-default giveMeSomeSpace leaveMeAlone" id="btnAddNewSecureFolder">
        Add a secure folder
    </button>*@


    <div class="modal" id="modal-new-secFolder" tabindex="-1" role="dialog" aria-labelledby="modal-new-secFolder" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close cancel" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title">Add a new secure folder</h4>
                </div>
                <div class="modal-body">
                    @Html.Partial("CreateNewSecureFolder")
                </div>
            </div>
        </div>
    </div>

<script>
    function openTheCreateWindow() {
        $('#modal-new-secFolder').modal('show');
    }
</script>

Check in Chrome Developer Tools if 检入Chrome开发者工具是否

<div class="modal-backdrop fade in"></div>

exists right before closing </body> tag. </body>标记之前存在。

Styles for this div: 该div的样式:

在此处输入图片说明

Also try to remove 也尝试删除

aria-hidden="true"

attribute from your modal dialog. 属性对话框中的属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM