jquery.color.js小白知识_支持颜色动画处理的jQuery插件

jquery.color.js小白知识

GitHub:https://github.com/jquery/jquery-color

jquery.color.js小白知识_支持颜色动画处理的jQuery插件

简介描述:支持颜色动画处理的jQuery插件

Jquery本身不支持变色,Jquery Color.js弥补了这缺陷并为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>

支持的其他属性如下

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

海计划公众号
(0)
上一篇 2020/03/06 09:12
下一篇 2020/03/06 09:12

您可能感兴趣的内容