Custom add layer

As the value of layers Many plug-in I do not really like here I myself get estimates load level out with
custom add layers where I first filled with a div and then in the div inside a drawing label will be drawn to load layer out
here drawing words online search on it I can not say here

<div id="JZ" style="padding: 0;position:absolute;top:0;z-index:2;position:absolute;">
<canvas id="c" style="display: inline-block;width: 200px;
height: 150px;position:relative;top:260px;left:660px;"></canvas>
</div>

Here I give the outermost box is set up like a window width with high load in order not to end after layer displays can also point to the button.

$(function () {
    sethw();
});
window.onresize = function () {
    sethw();
}
function sethw() {
    var height = window.innerHeight;
    var width = window.innerWidth;
    var JZ = document.getElementById("JZ");
    JZ.style.height = (height-1) + "px";
    JZ.style.width = width + "px";
}

Outside the box to cover all of the content to load only the layer.
Here I also wrote how to trigger the load level, load level is due to the start I do not need to call it the div tag with plotting to hide out. When you need to call a function I wrote to then call out

<div id="JZ" style="padding: 0;position:absolute;top:0;zindex:2;position:absolute;display:none">
        <canvas id="c" style="display: inline-block;width: 200px;height: 150px;position:relative;top:260px;left:660px;display:none"></canvas>
</div>

Then I wrote then call the function, I use the most simple display with hidden box, where first of all get to the box and drawing ID tag, and then go back and change his style on it. OpenC display is loaded layer, closeC load layer is hidden.

function openC() {
    var JZ = document.getElementById("JZ");
    var c = document.getElementById("c");
    JZ.style.display = "block";
    c.style.display = "block";
}
function closeC() {
    var JZ = document.getElementById("JZ");
    var c = document.getElementById("c");
    JZ.style.display = "none";
    c.style.display = "none";
}

When the outside need to call just need to load the layer functions written back on. The following code.
// Verify Login

function SelectUser() {
            var UserNuber = $("#UserNuber").val();
            var password = $("#password").val();
            openC();//开启加载层
            $.post("/Main/SelectUser",
                {
                    UserNuber: UserNuber,
                    Password: password
                },
                function (returnJson) {
                    //关闭加载层
                    closeC();
                    if (returnJson.State == true) {
                        window.location.replace("/Main/Main");
                    }
                    else {
                        layer.alert(returnJson.Text, { icon: 0, title: "提示" });
                    }
                });
        }

The above is from the entire contents of the definition of loaded layer

Guess you like

Origin blog.csdn.net/weixin_44486126/article/details/90632024