Javascript ';彩色动画插件';不';不在webkit上工作(safari chrome)
颜色动画在webkit(safari chrome)上不起作用Javascript ';彩色动画插件';不';不在webkit上工作(safari chrome),javascript,jquery,Javascript,Jquery,颜色动画在webkit(safari chrome)上不起作用 s $('#start')。动画({'backgroundColor':'yellow'},1000,'linear',function(){ }) 它在firefox上运行良好 为什么? 谢谢 答案是背景,看下一个代码 您将发现a未运行,b正常(在safari和chrome中): $('a,'b')。动画({backgroundColor:“orange”},1000) .animate({backgroundColor:
s
$('#start')。动画({'backgroundColor':'yellow'},1000,'linear',function(){
})
它在firefox上运行良好
为什么?
谢谢
答案是背景,看下一个代码 您将发现a未运行,b正常(在safari和chrome中):
$('a,'b')。动画({backgroundColor:“orange”},1000)
.animate({backgroundColor:“yellow”},1000)
.animate({backgroundColor:“green”},1000)
从您的示例中,我注意到两件事:
首先,脚本标记中有一个零散的字母s
。不确定这是否存在于您的代码中,或者不同的浏览器如何处理它
其次,您实际上没有将脚本主体包装在任何类型的
文档中。ready
类型包装器,并且您没有将函数绑定到事件处理程序,这意味着,至少在您向我们展示的情况下,脚本可能在文档准备好之前加载,它没有看到#start
元素,所以它什么也没做。您编写的示例看起来不完整。暂时忽略我的答案。演示站点在您的Chrome版本上运行吗?好了,新答案出来了。如果有帮助,请告诉我。
<script type="text/javascript" src="jquery.color.js">s</script>
$('#start').animate({ 'backgroundColor':'yellow' }, 1000,'linear', function() {
})
<dl id=a style="width:100px;height:100px;">
</dl>
<dl id=b style="width:100px;height:100px;background:#fff">
</dl>
<script src="jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="jquery.color.js" type="text/javascript"></script>
<script type="text/javascript">
$('#a,#b').animate({ backgroundColor: "orange" }, 1000)
.animate({ backgroundColor: "yellow" }, 1000)
.animate({ backgroundColor: "green" }, 1000)
</script>