当前位置:首页>正文

jquery中的animate方法是不是不能改变div的背景颜色 jquery animate支持字体颜色样式吗

2023-04-20 13:24:54 互联网 未知

jquery中的animate方法是不是不能改变div的背景颜色

jquery的animate不能改变background-color;原文:Allanimatedpropertiesshouldbeanimatedtoasinglenumericvalue,exceptasnotedbelowmostpropertiesthatarenon-numericcannotbeanimatedusingbasicjQueryfunctionality(Forexample,width,height,orleftcanbeanimatedbutbackground-colorcannotbe,unlessthejQuery.Color()pluginisused)

jquery animate支持字体颜色样式吗

animate() 方法执行 CSS 属性集的自定义动画。
该方法通过CSS样式将元素从一个状态改变为另一个状态。CSS属性值是逐渐改变的,这样就可以创建动画效果。
只有数字值可创建动画(比如 "margin:30px")。字符串值无法创建动画(比如 "background-color:red")。

jQuery的animate()的使用方法

<body>
<img src="files/images/ll.gif" width="300" height="150" />
<script type="text/javascript">
$(function(){
$("img").click(function(){
$(this).animate({"height":"600px"},1000).animate({"height":"150px"},1000)
})
})
</script>
<br />
请点击上面图片!!
</body>

这样就行了,请注意,要导入jquery插件。