• js手写弹框和按钮显示


    业务场景:实现一个按钮,点击按钮弹框提示

    1、定义样式

    .bgcBox {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 100;
        display: none;
    }
    .bgcBox .bgc {
        position: fixed;
        z-index: 110;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.2);
    }
    .bgcBox .titles {
        background-color: #fff;
        font-size: 12px;
        position: fixed;
        z-index: 120;
        width: 240px;
        height: 120px;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        color: black;
    }
    .bgcBox .titles > p {
        margin: 20px 15px;
    }
    .bgcBox .titles > div {
        background-color: rgb(76, 116, 242);
        color: #fff;
        width: 80px;
        height: 30px;
        text-align: center;
        line-height: 30px;
        margin: 0 auto;
        border-radius: 4px;
        cursor: pointer;
    }

    2、编写对应的div

    <div class="bgcBox">
            <div class="bgc"></div>
            <div class="titles">
                <p>继续!</p>
                <div onclick="hideContinueTips()">我知道了</div>
            </div>
        </div>

    3、实现对应的javascript动作

    <a href="javascript:void(0);" onclick="showContinueTips()" title="点击继续"><span>继续</span></a>
    //点击继续
       function showContinueTips() {
       $(".bgcBox").show();
    }
    //点击我知道了
    function hideContinueTips(){
       $(".bgcBox").hide();
    }
    

      

  • 相关阅读:
    bzoj 5092: [Lydsy1711月赛]分割序列
    bzoj1173: [Balkan2007]Point
    bzoj1536: [POI2005]Akc- Special Forces Manoeuvres
    bzoj2178: 圆的面积并
    bzoj1043 下落的圆盘
    bzoj2674 Attack
    bzoj1201: [HNOI2005]数三角形
    bzoj3135: [Baltic2013]pipesd
    bzoj1760 [Baltic2009]Triangulation
    bzoj3136
  • 原文地址:https://www.cnblogs.com/antonyhubei/p/12711653.html
Copyright © 2020-2023  润新知