HTML和JS完成页面点击四个角弹出管理页面

博客分享了两种实现方法,涉及HTML、CSS和JS代码。方法1包含HTML、CSS和JS代码,方法2包含HTML和JS代码。代码来源为https://www.cnblogs.com/luzhanshi/p/10902654.html 。

 

实现方法1:

HTML代码:

        <div class="top-left-corner"></div>
        <div class="top-right-corner"></div>
        <div class="bottom-left-corner"></div>
        <div class="bottom-right-corner"></div>

CSS代码:

.top-left-corner {
    width: 100px;
    height: 100px;
    background: #fff;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
}

.top-right-corner {
    width: 100px;
    height: 100px;
    background: #fff;
    position: absolute;
    top: 0;
    right: 0;
    opacity: 0;
}

.bottom-left-corner {
    width: 100px;
    height: 100px;
    background: #fff;
    position: absolute;
    bottom: 0;
    left: 0;
    opacity: 0;
}

.bottom-right-corner {
    width: 100px;
    height: 100px;
    background: #fff;
    position: absolute;
    bottom: 0;
    right: 0;
    opacity: 0;
}

JS代码:

let [left_top_flag, right_top_flag, left_bottom_flag, right_bottom_flag] = [0, 0, 0, 0];

$('.top-left-corner').on("vmousedown", function () {
    [left_top_flag, right_top_flag, left_bottom_flag, right_bottom_flag] = [1, 0, 0, 0];
    $(this).css({"background": "#999", "opacity": "0.5", "border-radius": "50px"});
});

$('.top-right-corner').on("vmousedown", function () {
    if (left_top_flag) right_top_flag = 1;
    else return;
    $(this).css({"background": "#999", "opacity": "0.5", "border-radius": "50px"});
});

$('.bottom-right-corner').on("vmousedown", function () {
    if (left_top_flag && right_top_flag) left_bottom_flag = 1;
    else return;
    $(this).css({"background": "#999", "opacity": "0.5", "border-radius": "50px"});
});

$('.bottom-left-corner').on("vmousedown", function () {
    if (left_top_flag && right_top_flag && left_bottom_flag) [left_top_flag, right_top_flag, left_bottom_flag, right_bottom_flag] = [0, 0, 0, 0];
    else return;
    $(this).css({"background": "#999", "opacity": "0.5", "border-radius": "50px"});
    $('.top-left-corner').css('background', 'none');
    $('.top-right-corner').css('background', 'none');
    $('.bottom-left-corner').css('background', 'none');
    $('.bottom-right-corner').css('background', 'none');
    openInframe("views/admin/chooseLogin.html", "进入管理员登录界面");
});

 实现方法2:

HTML代码:

<div class="hidediv" id="tl"style="position:fixed; left:0px;top:0px;width:100px;height:100px;border:0px solid red;z-index:9999"></div>
<div class="hidediv"id="tr"style="position:fixed; left:1180px;top:0px;width:100px;height:100px;border:0px solid red;z-index:9999"></div>
<div class="hidediv"id="bl"style="position:fixed; left:0px;top:680px;width:100px;height:100px;border:0px solid red;z-index:9999"></div>
<div class="hidediv" id="br"style="position:fixed; left:1180px;top:680px;width:100px;height:100px;border:0px solid red;z-index:9999"></div>
    

JS代码:

$(".hidediv").click(hidedivCallback);

// 桌面四个角点击事件回调
function hidedivCallback() {
    if (this.id == "tl") {
        global.hideKey = "12";
        $(this).addClass("bg-color-green");
    } else if (this.id == "tr" && global.hideKey == "12") {
        global.hideKey = "1234";
        $(this).addClass("bg-color-green");
    } else if (this.id == "br" && global.hideKey == "1234") {
        global.hideKey = "123456";
        $(this).addClass("bg-color-green");
    } else if (this.id == "bl" && global.hideKey == "123456") {
        global.hideKey = "";
        $(".hidediv").removeClass("bg-color-green");
        // parent.frames['mainframe'].location.href = "core/maintance/index.html";
        parent.frames['mainframe'].location.href = "maintanceBranch.html"; //将core/maintance/index.html 修改为中转页面增加指纹采集
    } else {
        global.hideKey = "";
        $(".hidediv").removeClass("bg-color-green");
    }
}

 

转载于:https://www.cnblogs.com/luzhanshi/p/10902654.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值