html实现,支付成功动画(动态),提示界面

利用html盒子的隐藏


html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>支付成功</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <div><button id="showButton">显示支付状态</button></div>
    
    <!-- 模态框 -->
    <div id="myModal" class="modal">
        <div class="modal-content">
            <div class="checkmark-circle">
                <div class="checkmark"></div>
            </div>
            <p>支付成功</p>
        </div>
    </div>

    <script>
        document.getElementById('showButton').addEventListener('click', function() {
            var modal = document.getElementById('myModal');
            modal.style.display = 'block';
            setTimeout(function() {
                modal.style.display = 'none';
            }, 1000); // 3秒后隐藏模态框
        });
    </script>
</body>
</html>

 css


body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f5f5f5;
margin: 0;
}

.container {
text-align: center;
}

.checkmark-circle {
width: 100px;
height: 100px;
position: relative;
display: inline-block;
}

.checkmark-circle .background {
width: 100px;
height: 100px;
border-radius: 50%;
background: #4caf50;
position: absolute;
top: 0;
left: 0;
animation: scaleAnimation 0.3s ease-in-out;
}

@keyframes scaleAnimation {
0% {
transform: scale(0);
}
100% {
transform: scale(1);
}
}

.checkmark {
width: 35px;
height: 70px;
border: solid white;
border-width: 0 10px 10px 0;
position: absolute;
top: 18px;
left: 28px;
transform: rotate(45deg);
animation: checkmarkAnimation 0.5s ease-in-out forwards;
}

@keyframes checkmarkAnimation {
0% {
height: 0;
width: 0;
}
40% {
height: 0;
width: 35px;
}
100% {
height: 70px;
width: 35px;
}
}

p {
font-size: 24px;
color: #4caf50;
margin-top: 20px;
font-family: Arial, sans-serif;
}
 /* 模态框背景 */
 .modal {
    display: none; 
    position: fixed; 
    z-index: 1; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; 
    background-color: rgb(0,0,0); 
    background-color: rgba(0,0,0,0.4); 
}

/* 模态框内容 */
.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 300px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.checkmark-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: green;
    position: relative;
    margin: 0 auto;
}

.checkmark {
    position: absolute;
    width: 40px;
    height: 80px;
    transform: rotate(45deg);
    top: -10px;
    left: 18px;
}

.checkmark::before {
    content: '';
    position: absolute;
    height: 5px;
    width: 20px;
    background-color: white;
    top: 37px;
    left: 11px;
}

.checkmark::after {
    content: '';
    position: absolute;
    height: 5px;
    width: 45px;
    background-color: white;
    top: 27px;
    left: 11px;
}

演示:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值