酷炫弹窗效果

酷炫弹窗效果

  • HTML

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>弹窗效果</title>
        <script src="./js/jquery.min.js"></script>
        <script src="./js/index.js"></script>
        <style>
            *{
                margin: 0;
                padding: 0;
                box-sizing: border-box;
            }
            #my_button{
                width: 100px;
                height: 50px;
            }
        </style>
        <link rel="stylesheet" href="./css/index.css">
    </head>
    <body>
        <button id="my_button">弹窗</button>
        <div class="filterbg"></div>
        <div class="popup">
            <a href="javascript:;" class="popupClose"></a>
            <div class="summary">
            </div>
        </div>
    </body>
    </html>
    
  • css

    filterbg {
        width: 100%;
        height: 100%;
        background: rgba(30, 182, 254, 0.5);
        position: absolute;
        top: 0;
        left: 0;
        z-index: 998;
        display: none;
    }
    .popup {
        width: 0;
        height: 0;
        background: #061f3e;
        position: absolute;
        top: 50%;
        left: 50%;
        z-index: 999;
        border-radius: 8px;
        display: none;
        -webkit-transform: translate(-50%, -50%);
        -moz-transform: translate(-50%, -50%);
        -ms-transform: translate(-50%, -50%);
        -o-transform: translate(-50%, -50%);
        transform: translate(-50%, -50%);
    }
    .popup .popupClose {
        display: block;
        width: 44px;
        height: 44px;
        background: url(../img/s_ico3.png);
        background-size: 100 100%;
        position: absolute;
        top: -22px;
        right: -22px;
        display: none;
        transition: 0.3s;
    }
    
    .popup .popupClose:hover {
        transform: rotate(180deg);
    }
    
  • JS

    		$(()=>{
    	    $('#my_button').on('click', function () {
    	        $('.filterbg').show();
    	        $('.popup').show();
    	        $('.popup').width('3px');
    	        $('.popup').animate({
    	            height: '90%'
    	        }, 400, function () {
    	            $('.popup').animate({
    	                width: '95%'
    	            }, 400);
    	        });
    	        setTimeout(summaryShow, 800);
    	    });
    	    function summaryShow() {
    	        $('.popupClose').css('display', 'block');
    	        $('.summary').show();
    	    };
    	    $('.popupClose').on('click', function () {
    	        $('.popupClose').css('display', 'none');
    	        $('.summary').hide();
    	        $('.popup').animate({
    	            width: '3px'
    	        }, 400, function () {
    	            $('.popup').animate({
    	                height: 0
    	            }, 400);
    	        });
    	        setTimeout(summaryHide, 800);
    	    });
    	    function summaryHide() {
    	        $('.filterbg').hide();
    	        $('.popup').hide();
    	        $('.popup').width(0);
    	    };
    	})
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值