js+css实现按钮点击涟漪动画效果代码

代码语言:html

所属分类:布局界面

代码描述:js+css实现按钮点击涟漪动画效果代码

代码标签: js css 按钮 点击 涟漪 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
    :root {
    --background-color: #000000;
    --show_color1: #007db7;
    --show_color2: #d5278a;
}

* {
    margin: 0;
    padding: 0;
}

body {
    width: 100vw;
    height: 100vh;
    background-color: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.bt {
    font-size: 30px;
    color: #fff;
    background: linear-gradient(90deg, var(--show_color1), var(--show_color2));
    padding: 24px 80px;
    border-radius: 60px;
    position: relative;
    overflow: hidden;
}

.bt span {
    position: absolute;
    background-color: #FFF;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: show 1s;
}

@keyframes show {
    0% {
        opacity: 0.5;
        width: 0;
        height: 0;
    }

    100% {
        opacity: 0;
        width: 400px;
        height: 400px;
    }
}
</style>
</head>

<body>
    <div class="bt">Submit</div>
    <script>
        const bt = document.querySelector(.........完整代码请登录后点击上方下载按钮下载查看

网友评论0