jquery動態改變背景顏色插件

GETHUB下載地址


背景顏色用animate方法時時無法改變顏色的

所以要使用插件進行補充。



使用方法:

<!DOCTYPE html>
<html>
<head>
<style>
div {
    background-color: #bada55;
    width: 100px;
    border: 1px solid green;
}
</style>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="jquery.color.min.js"></script>
</head>
<body>
<button id="go">Simple</button>
<button id="sat">Desaturate</button>
<div id="block">Hello!</div>
<script>
jQuery("#go").click(function(){
    jQuery("#block").animate({
            backgroundColor: "#abcdef"
    }, 1500 );
});
jQuery("#sat").click(function(){
    jQuery("#block").animate({
            backgroundColor: jQuery.Color({ saturation: 0 })
    }, 1500 );
});
</script>
</body>
</html>





發佈了74 篇原創文章 · 獲贊 43 · 訪問量 24萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章