JQ - 达内客服涟漪效果

image.png
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style media="screen">
        * {
            margin: 0;
            padding: 0;
        }

        #box {
            width: 500px;
            height: 100px;
            background-color: #ea6f5a;
            position: relative;
            border-radius: 50px;
            left: 200px;
            top: 200px;
            overflow: hidden;
        }

        .yuan {
            width: 2px;
            height: 2px;
            background-color: #fff;
            position: absolute;
            left: 50%;
            top: 50%;
            border-radius: 1px;
            margin-left: -1px;
            margin-top: -1px;
        }
    </style>
</head>

<body>
    <div id="box">
        <div class="yuan"></div>
    </div>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.12.0/jquery.min.js"></script>
    <script type="text/javascript">
        var $yuan = $('.yuan');
        var $box = $('#box');

        setInterval(function() {
            $yuan.animate({
                'width': 500,
                'height': 500,
                'borderRadius': 250,
                'marginLeft': -250,
                'marginTop': -250,
                'opacity': 0
            }, 1000, function() {
                $(this).css({
                    'width': 2,
                    'height': 2,
                    'borderRadius': 1,
                    'marginLeft': -1,
                    'marginTop': -1,
                    'opacity': 1
                });
            })
        }, 1000)
    </script>
</body>

</html>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。