jquery.color.js的使用


Jquery本身不支持變色,Jquery Color.js彌補了這缺陷並為animate動畫賦予變色效果,如下紅變藍后執行回調再由藍變紅。

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style>
        #box {
            width:100px;
            height:100px;
            background-color:red;
            cursor:pointer;
        }
    </style>
</head>
<body>
    <div class="box" id="box"></div>
    <script type="text/javascript" src="/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="/js/jquery.color.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#box").mouseenter(function () {
                $(this).stop(true, true).animate({ "backgroundColor": 'blue' }, 5400, function () {
                    $(this).animate({ "backgroundColor": 'red' }, 5400);
                });
            });
        });
    </script>
</body>
</html>

 

支持的其他屬性如下

backgroundColor, borderBottomColor, borderLeftColor, borderRightColor, borderTopColor, color, columnRuleColor, outlineColor, textDecorationColor, textEmphasisColor


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM