css

按钮点击效果

1缩小放大

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<style>
    #btn{
        width: 200px;
        height: 80px;
        line-height: 80px;
        background: #cccccc;
        text-align: center;
        font-size: 30px;

    }
    #btn.active{
        animation: show 1s;
    }
    @keyframes show {
        0%{
            transform: scale(.9);
        }
        50%{
            transform: scale(1);
        }
    }
</style>
<div id="btn">btn</div>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script>
    $("#btn").click(function () {
      $(this).addClass('active').one('animationend',function () {
        $(this).removeClass('active')
      })
    })
</script>
</body>
</html>
View Code

2.波纹效果  https://mladenplavsic.github.io/css-ripple-effect/#

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .ripple {
            position: relative;
            /*//隐藏溢出的径向渐变背景*/
            overflow: hidden;
        }

        .ripple:after {
            content: "";
            display: block;
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            pointer-events: none;
            /*//设置径向渐变*/
            background-image: radial-gradient(circle, #666 10%, transparent 10.01%);
            background-repeat: no-repeat;
            background-position: 50%;
            transform: scale(10, 10);
            opacity: 0;
            transition: transform .3s, opacity .5s;
        }

        .ripple:active:after {
            transform: scale(0, 0);
            opacity: .3;
            /*!/设置初始状态*/
            transition: 0s;
        }
        .btn{
            width:100px;
            height: 50px;
            line-height: 50px;
            text-align: center;
            background: #cccccc;
        }
    </style>
</head>
<body>
    <div class="ripple btn">btn</div>
</body>
</html>
View Code

 

posted @ 2019-05-22 14:52  gyz418  阅读(121)  评论(0编辑  收藏  举报