标签:width doc window rem ntb style mask move btn
var mask = document.getElementsByClassName("mask")[0];
var out = document.getElementsByClassName("out")[0];
var btn1 = document.getElementById("btn1");
var c_height = document.documentElement.clientHeight;
var c_width = document.documentElement.clientWidth;
var top_ = c_height / 2 -200;
var left = c_width / 2 - 300;
mask.style.height = c_height + "px";
out.style.top = top_ + "px";
out.style.left = left + "px";
btn1.onclick = function() {
mask.removeAttribute("hidden");
out.removeAttribute("hidden");
}
mask.onclick = function() {
mask.setAttribute("hidden", "hidden");
out.setAttribute("hidden", "hidden");
}
window.onresize = function() {
var c_height = document.documentElement.clientHeight;
var c_width = document.documentElement.clientWidth;
var top_ = c_height / 2 - 200;
var left = c_width / 2 - 300;
mask.style.height = c_height + "px";
out.style.top = top_ + "px";
out.style.left = left + "px";
}
swal(
‘1‘,
‘2‘,
‘success‘
)
标签:width doc window rem ntb style mask move btn
原文地址:http://www.cnblogs.com/buzhiheyan/p/7613239.html