在网页中放置Bootstrap Dialog Model

时间:2015-09-18 18:55:03

标签: jquery asp.net twitter-bootstrap modal-dialog

我在我的网站上使用了Bootstarp模式,但当我尝试用按钮点击这个模态时

<input type="image" name="ImageButton4" id="ImageButton4" class="bw" data-target="#pnlModal" data-toggle="modal" src="Images/note.png" onclick="javascript:return false;" style="width:15%;" />
  

它显示了这张照片的禁用模型! in active modal

这是我的模型CSS代码,它存在于bootstrap.cs`

 </div>
    <asp:Panel ID="pnlModal" runat="server" role="dialog" CssClass="modal fade">
        <asp:Panel ID="pnlInner" runat="server" CssClass="modal-dialog" >
            <asp:Panel ID="pnlContent" CssClass="modal-content" runat="server">
                <asp:Panel runat="server" class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
                    </button>
                    <h4 class="modal-title">Write Your Note Now ! we'll save it in "D" partition </h4>
                </asp:Panel>
                <asp:panel runat="server" class="modal-body">
                  <asp:TextBox ID="NoteText"  TextMode="MultiLine" CssClass="form-control" Font-Size="Larger" Font-Bold="true" runat="server"></asp:TextBox>
                 </asp:panel>
                <asp:panel runat="server" class="modal-footer">
                    <asp:LinkButton  OnClick="Button1_Click1" ID="Button1" runat="server"  CssClass="btn btn-success"  >Write Now ! </asp:LinkButton>
                </asp:panel>
            </asp:Panel>
        </asp:Panel>
    </asp:Panel>

以及所有模态标记

&#13;
&#13;
.modal-open {
  overflow: hidden;
}
.modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1050;
  display: none;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  outline: 0;
}
.modal.fade .modal-dialog {
  -webkit-transition: -webkit-transform .3s ease-out;
       -o-transition:      -o-transform .3s ease-out;
          transition:         transform .3s ease-out;
  -webkit-transform: translate(0, -25%);
      -ms-transform: translate(0, -25%);
       -o-transform: translate(0, -25%);
          transform: translate(0, -25%);
}
.modal.in .modal-dialog {
  -webkit-transform: translate(0, 0);
      -ms-transform: translate(0, 0);
       -o-transform: translate(0, 0);
          transform: translate(0, 0);
}
.modal-open .modal {
  overflow-x: hidden;
  overflow-y: auto;
}
.modal-dialog {
  position: relative;
  width: auto;
  margin: 10px;
}
.modal-content {
  position: relative;
  background-color: #fff;
  -webkit-background-clip: padding-box;
          background-clip: padding-box;
  border: 1px solid #999;
  border: 1px solid rgba(0, 0, 0, .2);
  border-radius: 6px;
  outline: 0;
  -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
          box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
}
.modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  background-color: #000;
}
.modal-backdrop.fade {
  filter: alpha(opacity=0);
  opacity: 0;
}
.modal-backdrop.in {
  filter: alpha(opacity=50);
  opacity: .5;
}
.modal-header {
  min-height: 16.42857143px;
  padding: 15px;
  border-bottom: 1px solid #e5e5e5;
}
.modal-header .close {
  margin-top: -2px;
}
.modal-title {
  margin: 0;
  line-height: 1.42857143;
}
.modal-body {
  position: relative;
  padding: 15px;
}
.modal-footer {
  padding: 15px;
  text-align: right;
  border-top: 1px solid #e5e5e5;
}
.modal-footer .btn + .btn {
  margin-bottom: 0;
  margin-left: 5px;
}
.modal-footer .btn-group .btn + .btn {
  margin-left: -1px;
}
.modal-footer .btn-block + .btn-block {
  margin-left: 0;
}
.modal-scrollbar-measure {
  position: absolute;
  top: -9999px;
  width: 50px;
  height: 50px;
  overflow: scroll;
}
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

显然,您的.modal元素位于 .modal-backdrop元素下。默认情况下,他们z-index'是

.modal-backdrop {
   z-index: 1040;
}
.modal {
   z-index: 1050;
}

您的代码/ CSS中的某些内容违反了此默认顺序。通过在 bootstrap.css和其他CSS声明之后添加上面的CSS 来重新引入z顺序。

<强>更新即可。您可以将其置于</head>之前或</body>之前的最后一件事,如果它不起作用:

<style type="text/css">
.modal-backdrop {
   z-index: 1040;
}
.modal {
   z-index: 1050;
}
</style>