• 自定义模态框


    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta http-equiv="x-ua-compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>自定义模态框</title>
      <style>
        .cover {
          position: fixed;
          left: 0;
          right: 0;
          top: 0;
          bottom: 0;
          background-color: darkgrey;
          z-index: 999;
        }
        .modal {
          width: 600px;
          height: 400px;
          background-color: white;
          position: fixed;
          left: 50%;
          top: 50%;
          margin-left: -300px;
          margin-top: -200px;
          z-index: 1000;
        }
        .hide {
          display: none;
        }
      </style>
    </head>
    <body>
    <input type="button" value="弹" id="i0">
    
    <div class="cover hide"></div>
    <div class="modal hide">
      <label for="i1">姓名</label>
      <input id="i1" type="text">
       <label for="i2">爱好</label>
      <input id="i2" type="text">
      <input type="button" id="i3" value="关闭">
    </div>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script>
      var tButton = $("#i0")[0];
      tButton.onclick=function () {
        var coverEle = $(".cover")[0];
        var modalEle = $(".modal")[0];
    
        $(coverEle).removeClass("hide");
        $(modalEle).removeClass("hide");
      };
    
      var cButton = $("#i3")[0];
      cButton.onclick=function () {
        var coverEle = $(".cover")[0];
        var modalEle = $(".modal")[0];
    
        $(coverEle).addClass("hide");
        $(modalEle).addClass("hide");
      }
    </script>
    </body>
    </html>
  • 相关阅读:
    hdu 1047 Integer Inquiry
    大数模板(高精度)
    git 学习
    java List 排序
    简单排序总结
    JDK1.8
    webservice 学习笔记 1
    inline-block,inline,block,table-cell,float
    mybatis 学习视频总结记录
    left join right inner join 区别
  • 原文地址:https://www.cnblogs.com/njuwyx/p/11656572.html
Copyright © 2020-2023  润新知