效果:

代码:
- html>
- <html lang="en">
-
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>弹出框title>
-
- <style>
- .icon {
- width: 1em;
- height: 1em;
- vertical-align: -1.17em;
- margin-left: 165px;
- fill: currentColor;
- overflow: hidden;
- }
-
- #main {
- width: 100%;
- height: 100%;
- background-color: rgba(82, 82, 87, 0.5);
- display: flex;
- justify-content: center;
- align-items: center;
- position: absolute;
- left: 0;
- top: 0;
- display: none;
- }
-
- #box {
- width: 474px;
- height: 57px;
- background: #F0F9EB;
- border-radius: 6px;
- position: absolute;
- /* z-index: 999; */
- }
-
- #stopIt {
- text-decoration: none;
- color: #17BE59;
- float: right;
- padding-top: 5px;
- margin-right: 10px;
- }
-
- p {
- font-size: 22px;
- font-family: Source Han Sans CN;
- font-weight: 400;
- color: #17BE59;
- margin: -21px 190px;
- }
-
- #box1 {
- width: 496px;
- height: 50px;
- border: 2px solid black;
- }
-
- #box2 {
- width: 0px;
- height: 50px;
- background-color: pink;
- }
- style>
- head>
-
- <body>
- <script src="../概述/script/iconfont.js">script>
- <input type="button" value="弹框" id="eject">
- <div id="main">
- <div id="box">
- //对号
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-tijiaochenggong">use>
- svg>
- //差号
- <svg class="icon" id="stopIt" aria-hidden="true">
- <use xlink:href="#icon-guanbi">use>
- svg>
- <p>提交成功p>
- div>
- div>
- <script>
- let eject = document.getElementById("eject");
- let main = document.getElementById("main");
- let stopIt = document.getElementById("stopIt");
- //点击出现弹框
- eject.onclick = function () {
- main.style.display = "flex";
- }
- //点击×弹框消失
- stopIt.onclick = function () {
- main.style.display = "none";
- }
- script>
- body>
-
- html>
字体JS文件:cankao
window._iconfont_svg_string_='',function(n){var t=(t=document.getElementsByTagName("script"))[t.length-1],e=t.getAttribute("data-injectcss"),t=t.getAttribute("data-disable-injectsvg");if(!t){var i,o,c,d,s,a=function(t,e){e.parentNode.insertBefore(t,e)};if(e&&!n.__iconfont__svg__cssinject__){n.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(t){console&&console.log(t)}}i=function(){var t,e=document.createElement("div");e.innerHTML=n._iconfont_svg_string_,(e=e.getElementsByTagName("svg")[0])&&(e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.width=0,e.style.height=0,e.style.overflow="hidden",e=e,(t=document.body).firstChild?a(e,t.firstChild):t.appendChild(e))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(i,0):(o=function(){document.removeEventListener("DOMContentLoaded",o,!1),i()},document.addEventListener("DOMContentLoaded",o,!1)):document.attachEvent&&(c=i,d=n.document,s=!1,r(),d.onreadystatechange=function(){"complete"==d.readyState&&(d.onreadystatechange=null,l())})}function l(){s||(s=!0,c())}function r(){try{d.documentElement.doScroll("left")}catch(t){return void setTimeout(r,50)}l()}}(window);