码迷,mamicode.com
首页 > Web开发 > 详细

JQuery Color: Do Color Animations with jQuery

时间:2015-11-16 06:12:12      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:

JQuery color, a jQuery plugin that adds the ability to do color animations to jQuery. Demo effect:

技术分享

Sample code:

<style>
    div {
        position: absolute;
        background-color: #fff;
        width: 90px;
        height: 90px;
        border: solid 1px #000;
    }

    #testElement1 {
        left: 50px;
    }

    #testElement2 {
        left: 200px;
    }
</style>

<div id="testElement1">
</div>

<div id="testElement2">
</div>
<script src="~/Scripts/jquery-2.1.4.min.js"></script>
<script src="~/Scripts/jquery.color-2.1.2.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#testElement1").animate({ backgroundColor: "#abcdef" }, 800)
                .animate({ backgroundColor: "#fff" }, 800)
                .animate({ backgroundColor: "#abcdef" }, 800)
                .animate({ backgroundColor: "#fff" }, 800);

            $("#testElement2").animate({ backgroundColor: "#969696" }, 800)
                .animate({ backgroundColor: "#fff" }, 800)
                .animate({ backgroundColor: "#969696" }, 800)
                .animate({ backgroundColor: "#fff" }, 800);
        });
    </script>

You can also fork the github: https://github.com/jquery/jquery-color

JQuery Color: Do Color Animations with jQuery

标签:

原文地址:http://www.cnblogs.com/laixiancai/p/4967951.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!