【问题标题】:Display a popup over a modal在模态框上显示一个弹出窗口
【发布时间】:2019-04-19 09:37:39
【问题描述】:

我想在我的用例中的模态框上显示一个弹出窗口。我无法在模态框上隐藏或显示任何弹出窗口或任何其他 div。没有为弹出窗口设置顶部和左侧位置。 我已经尝试过 z-index 但它不起作用。

CSS:

<button id="button1">click</button>
<div class="modal" id="abc">
   <div class="content">
       <h1>Hi</h1>
       <div id="popupabc" hidden="hidden">
         <h1>Hello</h1>
       </div>
   </div>
</div>

JQuery:

$(function(){

$("#button1).on('click',function(e){
   $("#abc").modal('show');
});

$(document).on('click',function(e){
   // getting mouse click positions left(x) and top(y).
   $("#popupabc").css({position:'absolute',left:x,top:y});
   $("#popupabc").show();
});

}

【问题讨论】:

标签: jquery html css modal-dialog popup


【解决方案1】:
<script type="text/javascript">
         function ShowPopup(title, body) {
             $("#MyPopup .modal-title").html(title);
             $("#MyPopup .modal-body").html(body);
             $("#MyPopup").modal("show");
         }
</script>
     <style>
      blink {
        animation: blinker 0.6s linear infinite;
        color: #1c87c9;
       }
      @keyframes blinker {  
        50% { opacity: 0; }
       }
       .blink-one {
         animation: blinker-one 1s linear infinite;
       }
       @keyframes blinker-one {  
         0% { opacity: 0; }
       }
       .blink-two {
         animation: blinker-two 1.4s linear infinite;
       }
       @keyframes blinker-two {  
         100% { opacity: 0; }
       }
    </style>

    <div id="MyPopup" class="modal fade" role="dialog" style="margin-top: 236px;margin-left: 245px;width:500px">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                    &times;</button>
                <h4 class="modal-title">
                      <%--<img src="../../Images/banner.jpg" class=" img-responsive" style="width: 100%; height:450px">--%>
                    <blink>Here you can type any message which you want..!!</blink>
                </h4>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-dismiss="modal">
                    Close</button>
            </div>
        </div>
    </div>
</div>

--这个是在aspx.cs代码中添加的------ ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup();", true);

【讨论】:

  • 用你的代码解释一下你的代码在做什么!
  • 这个是在.cs页面中添加的
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多