zoukankan      html  css  js  c++  java
  • Html网页模态居中弹窗

    html:

    <script type="text/javascript">
      // 打开弹窗
      function OpenDetail(show_div, mask_div, content) {
          setDivCenter("#" + show_div);
          document.getElementById(show_div).style.display = 'block';
          document.getElementById(mask_div).style.display = 'block';
    
          var bgdiv = document.getElementById(mask_div);
          bgdiv.style.width = document.body.scrollWidth;
    
          $("#" + mask_div).height($(document).height());
    
          document.getElementById('spContent').innerText = content;
      }
    
      function setDivCenter(divName) {
          var top = ($(window).height() - $(divName).height()) / 2;
          var left = ($(window).width() - $(divName).width()) / 2;
          var scrollTop = $(document).scrollTop();
          var scrollLeft = $(document).scrollLeft();
          $(divName).css({ position: 'absolute', 'top': top + scrollTop, left: left + scrollLeft });
      }
    
      // 关闭弹窗
      function CloseDiv(show_div, mask_div) {
          document.getElementById(show_div).style.display = 'none';
          document.getElementById(mask_div).style.display = 'none';
      };
    
    </script>
    
    <html>
    <head>
        <link href="css/popupWindow.css" rel="stylesheet" />
        <script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <head>
    <body>
        <!--弹出层时背景层DIV-->
        <div id="maskDiv" class="black_overlay">
          </div>
            <div id="popupDiv" class="white_content">
            <div style="cursor:default;height:50px; margin-right:10px;margin-top:5px;text-align:right">
            <a class="my_close" onclick="CloseDiv('popupDiv','maskDiv')">×</a>
          </div>
          <div class="container" style="98%" id="popupDivContainer">
            <span id="spContent" style="padding:0px 50px 0px 50px;word-break: normal;  auto; display: block; white-space: pre-wrap; word-wrap: break-word; overflow: hidden;"></span>
          </div>
        </div>
    </body>
    </html>

    popupWindow.css:

    body {
    }
    
    .black_overlay {
        display: none;
        position: absolute;
        top: 0%;
        left: 0%;
        width: 100%;
        height: 100%;
        background-color: black;
        z-index: 1001;
        -moz-opacity: 0.8;
        opacity: .80;
        filter: alpha(opacity=70);
    }
    
    .white_content {
        display: none;
        position: absolute;
        top: 10%;
        left: 10%;
        width: 80%;
        height: 80%;
        border: 2px solid lightblue;
        background-color: white;
        z-index: 1002;
        overflow: auto;
    }
    
    .white_content_small {
        display: none;
        position: absolute;
        top: 20%;
        left: 30%;
        width: 40%;
        height: 50%;
        border: 16px solid lightblue;
        background-color: white;
        z-index: 1002;
        overflow: auto;
    }
    
    .my_close {
        width: 24px;
        height: 24px;
        line-height: 24px;
        display: block;
        position: absolute;
        left: 10px;
        top: 10px;
        font-family: Helvetica, STHeiti;
        _font-family: 'u9ed1u4f53', 'Book Antiqua', Palatino;
        font-size: 18px;
        border-radius: 24px;
        background: #999;
        color: #FFF;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
        -moz-transition: linear .06s;
        -webkit-transition: linear .06s;
        transition: linear .06s;
        padding: 0;
        text-align: center;
        text-decoration: none;
        outline: none;
    }
    
        .my_close:hover {
            color: #FFF;
            box-shadow: 0 1px 3px rgba(209, 40, 42, .5);
            background: #d1282a;
            border-radius: 24px;
            transition: all 0.2s ease-out;
            opacity: 0.8;
            text-decoration: none;
        }
  • 相关阅读:
    获得二进制有多少个1
    读取txt数据
    int最大值
    oracle——数据表的相关操作——约束——各种约束详解
    oracle——数据表的相关操作——转移表空间
    oracle——数据表的相关操作——删除数据表
    oracle——数据表的数据查询——oracle高级函数
    oracle——数据表的相关操作——更新数据——update操作
    oracle——数据表的数据查询——oracle中的特殊表达式between and、in、like、is null、exists、all、some、any等
    oracle——数据表的数据查询——distinct 关键字、group by 字句、having子句
  • 原文地址:https://www.cnblogs.com/seanyan/p/14953786.html
Copyright © 2011-2022 走看看