jquery插件改变背景色

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title></title>
        <script src="jquery-1.11.1.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="jquery.color.js" type="text/javascript" charset="utf-8"></script>

        <style type="text/css">
            #box {
                background-color: red;
                width: 50px;
                height: 50px;
            }
        </style>

        <script type="text/javascript">
            $(document).ready(function() {
                $("button").on("click", function() {
                    $("#box").animate({
                        "background-color": "yellow",
                        "width": 200
                    }, 2000, function() {
                        alert("动画完成");
                    });
                });
            });
        </script>
    </head>
    <body>
        <button type="button">变色</button>
        <div id="box">
        </div>
    </body>
</html>

image

image

posted @ 2020-10-23 16:20  thomas_blog  阅读(139)  评论(0编辑  收藏  举报